|
| 1 | +/// |
| 2 | +/// Created by NieBin on 2018/12/25 |
| 3 | +/// Github: https://github.com/nb312 |
| 4 | + |
| 5 | +/// Modified by Srikanth on 2019/01/03 |
| 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'; |
| 12 | + |
| 13 | +class FeedPageTwo extends StatefulWidget { |
| 14 | + @override |
| 15 | + _FeedState createState() => _FeedState(); |
| 16 | +} |
| 17 | + |
| 18 | +class _FeedState extends State<FeedPageTwo> { |
| 19 | + Widget _textBack(content, |
| 20 | + {color = TEXT_BLACK_LIGHT, |
| 21 | + size = TEXT_SMALL_2_SIZE, |
| 22 | + isBold = false, |
| 23 | + softWrap: true}) => |
| 24 | + Text( |
| 25 | + content, |
| 26 | + style: TextStyle( |
| 27 | + color: color, |
| 28 | + fontSize: SizeUtil.getAxisBoth(size), |
| 29 | + fontWeight: isBold ? FontWeight.w700 : FontWeight.w300), |
| 30 | + ); |
| 31 | + |
| 32 | + Widget _listItemName() => Container( |
| 33 | + alignment: AlignmentDirectional.topStart, |
| 34 | + child: Column( |
| 35 | + mainAxisAlignment: MainAxisAlignment.end, |
| 36 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 37 | + children: <Widget>[ |
| 38 | + _textBack("Excepteur occacupidat non proident anim.", |
| 39 | + size: TEXT_NORMAL_2_SIZE, isBold: true), |
| 40 | + _textBack("1 MINUTE", size: TEXT_NORMAL_SIZE, isBold: false) |
| 41 | + ], |
| 42 | + ), |
| 43 | + ); |
| 44 | + |
| 45 | + Widget _listItem(index) => Container( |
| 46 | + child: Container( |
| 47 | + child: Stack( |
| 48 | + children: <Widget>[ |
| 49 | + Container( |
| 50 | + height: SizeUtil.getAxisY(550.0), |
| 51 | + width: SizeUtil.getAxisX(663.0), |
| 52 | + ), |
| 53 | + Positioned( |
| 54 | + left: SizeUtil.getAxisX(64.0), |
| 55 | + right: SizeUtil.getAxisX(124.0), |
| 56 | + top: SizeUtil.getAxisY(120.0), |
| 57 | + child: _listItemName(), |
| 58 | + ), |
| 59 | + Positioned( |
| 60 | + left: SizeUtil.getAxisX(3.0), |
| 61 | + right: SizeUtil.getAxisX(5.0), |
| 62 | + top: SizeUtil.getAxisY(70.0), |
| 63 | + child: Image.asset( |
| 64 | + index % 2 == 0 |
| 65 | + ? FeedImage.feed2_image1 |
| 66 | + : FeedImage.feed2_image2, |
| 67 | + fit: BoxFit.cover, |
| 68 | + width: SizeUtil.getAxisX(600.0), |
| 69 | + ), |
| 70 | + ), |
| 71 | + Positioned( |
| 72 | + width: SizeUtil.getAxisBoth(SQUARE_BUTTON_HEIGHT), |
| 73 | + height: SizeUtil.getAxisBoth(SQUARE_BUTTON_HEIGHT), |
| 74 | + left: SizeUtil.getAxisX(5.0), |
| 75 | + top: SizeUtil.getAxisY(100.0), |
| 76 | + child: Image.asset( |
| 77 | + index % 2 == 0 |
| 78 | + ? FeedImage.feed1_avatar1 |
| 79 | + : FeedImage.feed1_avatar2, |
| 80 | + fit: BoxFit.cover, |
| 81 | + ), |
| 82 | + ), |
| 83 | + Positioned( |
| 84 | + bottom: SizeUtil.getAxisY(70.0), |
| 85 | + child: Column( |
| 86 | + children: <Widget>[ |
| 87 | + Container( |
| 88 | + constraints: BoxConstraints.expand( |
| 89 | + height: SizeUtil.getAxisY(110.0), |
| 90 | + width: SizeUtil.getAxisX(603.0)), |
| 91 | + decoration: BoxDecoration( |
| 92 | + color: RED, borderRadius: BorderRadius.circular(10.0)), |
| 93 | + child: Center( |
| 94 | + child: Row( |
| 95 | + mainAxisAlignment: MainAxisAlignment.spaceAround, |
| 96 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 97 | + children: <Widget>[ |
| 98 | + Container( |
| 99 | + padding: EdgeInsets.all(10.0), |
| 100 | + width: 200.0, |
| 101 | + child: _textBack( |
| 102 | + "Excepteur occacupidat non proident anim.", |
| 103 | + size: TEXT_SMALL_SIZE, |
| 104 | + isBold: true), |
| 105 | + ), |
| 106 | + Container( |
| 107 | + padding: EdgeInsets.all(10.0), |
| 108 | + width: 70.0, |
| 109 | + child: _textBack("127 LIKES", |
| 110 | + size: TEXT_SMALL_SIZE, isBold: false), |
| 111 | + ), |
| 112 | + ], |
| 113 | + ), |
| 114 | + ), |
| 115 | + ), |
| 116 | + ], |
| 117 | + ), |
| 118 | + ), |
| 119 | + Positioned( |
| 120 | + bottom: SizeUtil.getAxisY(70.0), |
| 121 | + right: SizeUtil.getAxisX(0.0), |
| 122 | + child: Image.asset(FeedImage.heart, |
| 123 | + width: SizeUtil.getAxisY(CIRCLE_BUTTON_HEIGHT), |
| 124 | + height: SizeUtil.getAxisY(CIRCLE_BUTTON_HEIGHT)) |
| 125 | + ), |
| 126 | + ], |
| 127 | + ), |
| 128 | + )); |
| 129 | + |
| 130 | + Widget _body() => ListView.builder( |
| 131 | + itemBuilder: (context, index) { |
| 132 | + return Column( |
| 133 | + children: <Widget>[_listItem(index)], |
| 134 | + ); |
| 135 | + }, |
| 136 | + itemCount: 4, |
| 137 | + padding: EdgeInsets.only(top: 0.1), |
| 138 | + ); |
| 139 | + |
| 140 | + @override |
| 141 | + Widget build(BuildContext context) { |
| 142 | + return Scaffold( |
| 143 | + body: Container( |
| 144 | + decoration: BoxDecoration( |
| 145 | + gradient: LinearGradient( |
| 146 | + colors: [YELLOW, GREEN], |
| 147 | + begin: Alignment.topLeft, |
| 148 | + end: Alignment.centerLeft)), |
| 149 | + child: Column( |
| 150 | + children: <Widget>[ |
| 151 | + TopTitleBar(), |
| 152 | + Expanded( |
| 153 | + child: Container( |
| 154 | + padding: const EdgeInsets.symmetric( |
| 155 | + horizontal: 30.0, vertical: 10.0), |
| 156 | + child: Stack( |
| 157 | + children: <Widget>[ |
| 158 | + // Padding( |
| 159 | + // padding: const EdgeInsets.symmetric( |
| 160 | + // horizontal: 20.0, vertical: 10.0), |
| 161 | + // child: Container( |
| 162 | + // decoration: BoxDecoration( |
| 163 | + // boxShadow: [BoxShadow(color: Colors.grey)], |
| 164 | + // borderRadius: BorderRadius.circular(10.0), |
| 165 | + // gradient: LinearGradient( |
| 166 | + // colors: [YELLOW, GREEN], |
| 167 | + // begin: Alignment.topRight, |
| 168 | + // end: Alignment.centerLeft)), |
| 169 | + // ), |
| 170 | + // ), |
| 171 | + _body(), |
| 172 | + ], |
| 173 | + ), |
| 174 | + ), |
| 175 | + ), |
| 176 | + ], |
| 177 | + ), |
| 178 | + ), |
| 179 | + ); |
| 180 | + } |
| 181 | +} |
0 commit comments