|
2 | 2 | /// Created by NieBin on 2018/12/25
|
3 | 3 | /// Github: https://github.com/nb312
|
4 | 4 |
|
| 5 | +/// Modified by Srikanth on 2019/01/03 |
5 | 6 | ///
|
6 | 7 | import "package:flutter/material.dart";
|
| 8 | +import 'package:flutter_ui_nice/const/color_const.dart'; |
| 9 | +import 'package:flutter_ui_nice/page/feed/feed_const.dart'; |
| 10 | +import 'package:flutter_ui_nice/page/feed/top_title.dart'; |
| 11 | +import 'package:flutter_ui_nice/util/SizeUtil.dart'; |
7 | 12 |
|
8 | 13 | class FeedPageOne extends StatefulWidget {
|
9 | 14 | @override
|
10 | 15 | _FeedState createState() => _FeedState();
|
11 | 16 | }
|
12 | 17 |
|
13 | 18 | class _FeedState extends State<FeedPageOne> {
|
| 19 | + Widget _textBack(content, |
| 20 | + {color = TEXT_BLACK_LIGHT, |
| 21 | + size = TEXT_SMALL_2_SIZE, |
| 22 | + isBold = false}) => |
| 23 | + Text( |
| 24 | + content, |
| 25 | + style: TextStyle( |
| 26 | + color: color, |
| 27 | + fontSize: SizeUtil.getAxisBoth(size), |
| 28 | + fontWeight: isBold ? FontWeight.w700 : FontWeight.w300), |
| 29 | + ); |
| 30 | + |
| 31 | + Widget _listItemName() => Container( |
| 32 | + alignment: AlignmentDirectional.topStart, |
| 33 | + child: Column( |
| 34 | + mainAxisAlignment: MainAxisAlignment.end, |
| 35 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 36 | + children: <Widget>[ |
| 37 | + _textBack("Excepteur occacupidat non proident anim.", |
| 38 | + size: TEXT_NORMAL_2_SIZE, isBold: true), |
| 39 | + _textBack("1 MINUTE", size: TEXT_NORMAL_SIZE, isBold: false) |
| 40 | + ], |
| 41 | + ), |
| 42 | + ); |
| 43 | + |
| 44 | + Widget _listItem(index) => Container( |
| 45 | + child: Container( |
| 46 | + child: Stack( |
| 47 | + children: <Widget>[ |
| 48 | + Container( |
| 49 | + height: SizeUtil.getAxisY(850.0), |
| 50 | + width: SizeUtil.getAxisX(613.0), |
| 51 | + ), |
| 52 | + Positioned( |
| 53 | + left: SizeUtil.getAxisX(64.0), |
| 54 | + right: SizeUtil.getAxisX(124.0), |
| 55 | + top: SizeUtil.getAxisY(120.0), |
| 56 | + child: _listItemName(), |
| 57 | + ), |
| 58 | + Positioned( |
| 59 | + left: SizeUtil.getAxisX(5.0), |
| 60 | + top: SizeUtil.getAxisY(250.0), |
| 61 | + child: Image.asset( |
| 62 | + index % 2 == 0 ? FeedImage.landscape : FeedImage.landscape, |
| 63 | + fit: BoxFit.cover, |
| 64 | + width: SizeUtil.getAxisX(300.0), |
| 65 | + ), |
| 66 | + ), |
| 67 | + Positioned( |
| 68 | + right: SizeUtil.getAxisX(5.0), |
| 69 | + top: SizeUtil.getAxisY(250.0), |
| 70 | + child: Image.asset( |
| 71 | + index % 2 == 0 ? FeedImage.night : FeedImage.night, |
| 72 | + fit: BoxFit.cover, |
| 73 | + height: SizeUtil.getAxisX(245.0), |
| 74 | + ), |
| 75 | + ), |
| 76 | + Positioned( |
| 77 | + left: SizeUtil.getAxisX(200.0), |
| 78 | + bottom: SizeUtil.getAxisY(120.0), |
| 79 | + child: Image.asset( |
| 80 | + index % 2 == 0 ? FeedImage.menonglass : FeedImage.menonglass, |
| 81 | + fit: BoxFit.cover, |
| 82 | + height: SizeUtil.getAxisX(225.0), |
| 83 | + ), |
| 84 | + ), |
| 85 | + Positioned( |
| 86 | + left: SizeUtil.getAxisX(400.0), |
| 87 | + bottom: SizeUtil.getAxisY(200.0), |
| 88 | + child: Container( |
| 89 | + constraints: BoxConstraints.expand( |
| 90 | + height: SizeUtil.getAxisY(110.0), |
| 91 | + width: SizeUtil.getAxisX(110.0)), |
| 92 | + decoration: BoxDecoration( |
| 93 | + gradient: LinearGradient( |
| 94 | + begin: Alignment.topCenter, |
| 95 | + colors: [Colors.redAccent, Colors.pinkAccent]), |
| 96 | + borderRadius: BorderRadius.circular(10.0)), |
| 97 | + child: Center( |
| 98 | + child: Text('+33', |
| 99 | + style: Theme.of(context) |
| 100 | + .textTheme |
| 101 | + .title |
| 102 | + .copyWith(color: Colors.white)), |
| 103 | + ), |
| 104 | + )), |
| 105 | + Positioned( |
| 106 | + width: SizeUtil.getAxisBoth(SQUARE_BUTTON_HEIGHT), |
| 107 | + height: SizeUtil.getAxisBoth(SQUARE_BUTTON_HEIGHT), |
| 108 | + right: SizeUtil.getAxisX(5.0), |
| 109 | + top: SizeUtil.getAxisY(100.0), |
| 110 | + child: Image.asset( |
| 111 | + index % 2 == 0 |
| 112 | + ? FeedImage.feed1_avatar1 |
| 113 | + : FeedImage.feed1_avatar2, |
| 114 | + fit: BoxFit.cover, |
| 115 | + ), |
| 116 | + ), |
| 117 | + Positioned( |
| 118 | + bottom: SizeUtil.getAxisY(0.0), |
| 119 | + child: Column( |
| 120 | + children: <Widget>[ |
| 121 | + Container( |
| 122 | + constraints: BoxConstraints.expand( |
| 123 | + height: SizeUtil.getAxisY(110.0), |
| 124 | + width: SizeUtil.getAxisX(603.0)), |
| 125 | + decoration: BoxDecoration( |
| 126 | + color: RED, borderRadius: BorderRadius.circular(10.0)), |
| 127 | + child: Center( |
| 128 | + child: Row( |
| 129 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
| 130 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 131 | + children: <Widget>[ |
| 132 | + Column( |
| 133 | + mainAxisAlignment: MainAxisAlignment.center, |
| 134 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 135 | + children: <Widget>[ |
| 136 | + _textBack("7,455", |
| 137 | + size: TEXT_NORMAL_2_SIZE, isBold: true), |
| 138 | + _textBack("likes", |
| 139 | + size: TEXT_NORMAL_SIZE, isBold: false) |
| 140 | + ], |
| 141 | + ), |
| 142 | + Column( |
| 143 | + mainAxisAlignment: MainAxisAlignment.center, |
| 144 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 145 | + children: <Widget>[ |
| 146 | + _textBack("2,455", |
| 147 | + size: TEXT_NORMAL_2_SIZE, isBold: true), |
| 148 | + _textBack("comments", |
| 149 | + size: TEXT_NORMAL_SIZE, isBold: false) |
| 150 | + ], |
| 151 | + ), |
| 152 | + Column( |
| 153 | + mainAxisAlignment: MainAxisAlignment.center, |
| 154 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 155 | + children: <Widget>[ |
| 156 | + _textBack("455", |
| 157 | + size: TEXT_NORMAL_2_SIZE, isBold: true), |
| 158 | + _textBack("shares", |
| 159 | + size: TEXT_NORMAL_SIZE, isBold: false) |
| 160 | + ], |
| 161 | + ), |
| 162 | + ], |
| 163 | + ), |
| 164 | + ), |
| 165 | + ), |
| 166 | + ], |
| 167 | + ), |
| 168 | + ), |
| 169 | + |
| 170 | + ], |
| 171 | + ), |
| 172 | + )); |
| 173 | + |
| 174 | + Widget _body() => ListView.builder( |
| 175 | + itemBuilder: (context, index) { |
| 176 | + return Column( |
| 177 | + children: <Widget>[ |
| 178 | + _listItem(index), |
| 179 | + Padding( |
| 180 | + padding: const EdgeInsets.symmetric(horizontal: 40.0, vertical: 10.0), |
| 181 | + child: Divider(color: Colors.black87), |
| 182 | + ) |
| 183 | + ], |
| 184 | + ); |
| 185 | + }, |
| 186 | + itemCount: 4, |
| 187 | + padding: EdgeInsets.only(top: 0.1), |
| 188 | + ); |
| 189 | + |
14 | 190 | @override
|
15 | 191 | Widget build(BuildContext context) {
|
16 | 192 | return Scaffold(
|
17 |
| - appBar: AppBar( |
18 |
| - title: Text("Feed one"), |
| 193 | + body: Container( |
| 194 | + decoration: BoxDecoration( |
| 195 | + gradient: LinearGradient( |
| 196 | + colors: [YELLOW, GREEN], |
| 197 | + begin: Alignment.topLeft, |
| 198 | + end: Alignment.centerLeft)), |
| 199 | + child: Column( |
| 200 | + children: <Widget>[ |
| 201 | + TopTitleBar(), |
| 202 | + Expanded( |
| 203 | + child: Container( |
| 204 | + padding: const EdgeInsets.symmetric( |
| 205 | + horizontal: 30.0, vertical: 10.0), |
| 206 | + child: Stack( |
| 207 | + children: <Widget>[ |
| 208 | + Padding( |
| 209 | + padding: const EdgeInsets.symmetric( |
| 210 | + horizontal: 20.0, vertical: 10.0), |
| 211 | + child: Container( |
| 212 | + decoration: BoxDecoration( |
| 213 | + boxShadow: [BoxShadow(color: Colors.grey)], |
| 214 | + borderRadius: BorderRadius.circular(10.0), |
| 215 | + gradient: LinearGradient( |
| 216 | + colors: [YELLOW, GREEN], |
| 217 | + begin: Alignment.topRight, |
| 218 | + end: Alignment.centerLeft)), |
| 219 | + ), |
| 220 | + ), |
| 221 | + _body(), |
| 222 | + ], |
| 223 | + ), |
| 224 | + ), |
| 225 | + ), |
| 226 | + ], |
| 227 | + ), |
19 | 228 | ),
|
20 |
| - body: Text("Feed page one"), |
21 | 229 | );
|
22 | 230 | }
|
23 | 231 | }
|
0 commit comments