|
| 1 | +import 'package:flutter/material.dart'; |
| 2 | +import 'package:flutter_ui_nice/const/color_const.dart'; |
| 3 | +import 'package:flutter_ui_nice/page/feed/feed_const.dart'; |
| 4 | +import 'package:flutter_ui_nice/page/feed/top_title.dart'; |
| 5 | +import 'package:flutter_ui_nice/util/SizeUtil.dart'; |
| 6 | + |
| 7 | +class FeedPageFour extends StatefulWidget { |
| 8 | + @override |
| 9 | + _FeedPageFourState createState() => _FeedPageFourState(); |
| 10 | +} |
| 11 | + |
| 12 | +class _FeedPageFourState extends State<FeedPageFour> { |
| 13 | + Widget _pinkCard() { |
| 14 | + return Center( |
| 15 | + child: Container( |
| 16 | + margin: EdgeInsets.symmetric(vertical: 40.0), |
| 17 | + height: 450, |
| 18 | + width: deviceWidth * 0.73, |
| 19 | + decoration: BoxDecoration( |
| 20 | + borderRadius: BorderRadius.circular(22.0), |
| 21 | + boxShadow: [ |
| 22 | + BoxShadow( |
| 23 | + color: Colors.black12, |
| 24 | + blurRadius: 20.0, |
| 25 | + spreadRadius: 5.0, |
| 26 | + offset: Offset( |
| 27 | + 10.0, // horizontal, move right 10 |
| 28 | + 10.0, // vertical, move down 10 |
| 29 | + ), |
| 30 | + ) |
| 31 | + ], |
| 32 | + gradient: LinearGradient(colors: [RED_LIGHT, RED])), |
| 33 | + child: Column( |
| 34 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 35 | + children: <Widget>[ |
| 36 | + Container( |
| 37 | + width: double.infinity, |
| 38 | + margin: EdgeInsets.all(22), |
| 39 | + child: Text('1 MINUTE', |
| 40 | + style: TextStyle( |
| 41 | + color: Colors.black38, |
| 42 | + fontSize: SizeUtil.getAxisBoth(TEXT_SMALL_2_SIZE)), |
| 43 | + textAlign: TextAlign.right), |
| 44 | + ), |
| 45 | + Container( |
| 46 | + margin: EdgeInsets.symmetric(horizontal: 20), |
| 47 | + child: Text( |
| 48 | + 'Hristo added 127 new photos to Lorem Ipsum dolr sit amet.')), |
| 49 | + Expanded(child: Container()), |
| 50 | + Row( |
| 51 | + mainAxisAlignment: MainAxisAlignment.center, |
| 52 | + children: <Widget>[ |
| 53 | + _cardAction(favIcon, 123), |
| 54 | + Padding( |
| 55 | + padding: const EdgeInsets.symmetric(horizontal: 30.0), |
| 56 | + child: _cardAction(commentIcon, 67), |
| 57 | + ), |
| 58 | + _cardAction(shareIcon, 12), |
| 59 | + ], |
| 60 | + ) |
| 61 | + ], |
| 62 | + ), |
| 63 | + ), |
| 64 | + ); |
| 65 | + } |
| 66 | + |
| 67 | + Icon favIcon = Icon(Icons.favorite_border); |
| 68 | + Icon commentIcon = Icon(Icons.chat); |
| 69 | + Icon shareIcon = Icon(Icons.share); |
| 70 | + Widget _cardAction(Icon icon, int number) { |
| 71 | + return Container( |
| 72 | + margin: EdgeInsets.only(bottom: 20), |
| 73 | + child: Row( |
| 74 | + children: <Widget>[ |
| 75 | + icon, |
| 76 | + SizedBox(width: 5), |
| 77 | + Text('$number') |
| 78 | + ], |
| 79 | + ), |
| 80 | + ); |
| 81 | + } |
| 82 | + |
| 83 | + Widget _avatar() { |
| 84 | + return (Container( |
| 85 | + margin: EdgeInsets.only(top: 18, left: deviceWidth * 0.22), |
| 86 | + height: 50.0, |
| 87 | + width: 50.0, |
| 88 | + decoration: BoxDecoration( |
| 89 | + image: DecorationImage(image: AssetImage(FeedImage.feed1_avatar2))), |
| 90 | + )); |
| 91 | + } |
| 92 | + |
| 93 | + Widget _feedCardImages() { |
| 94 | + return Positioned( |
| 95 | + top: 180.0, |
| 96 | + left: 26, |
| 97 | + child: Container( |
| 98 | + height: 230, |
| 99 | + width: 350, |
| 100 | + decoration: BoxDecoration(boxShadow: [ |
| 101 | + BoxShadow( |
| 102 | + color: Colors.black12, |
| 103 | + blurRadius: 20.0, |
| 104 | + spreadRadius: 5.0, |
| 105 | + offset: Offset( |
| 106 | + 10.0, // horizontal, move right 10 |
| 107 | + 10.0, // vertical, move down 10 |
| 108 | + ), |
| 109 | + ) |
| 110 | + ], color: Colors.red, borderRadius: BorderRadius.circular(22.0)), |
| 111 | + ), |
| 112 | + ); |
| 113 | + } |
| 114 | + |
| 115 | + Widget _feedCard() { |
| 116 | + return Container( |
| 117 | + width: double.infinity, |
| 118 | + child: Stack( |
| 119 | + children: <Widget>[_pinkCard(), _avatar(), _feedCardImages()], |
| 120 | + ), |
| 121 | + ); |
| 122 | + } |
| 123 | + |
| 124 | + var deviceHeight; |
| 125 | + var deviceWidth; |
| 126 | + |
| 127 | + @override |
| 128 | + Widget build(BuildContext context) { |
| 129 | + deviceWidth = MediaQuery.of(context).size.width; |
| 130 | + deviceHeight = MediaQuery.of(context).size.height; |
| 131 | + return Scaffold( |
| 132 | + body: Container( |
| 133 | + decoration: |
| 134 | + BoxDecoration(gradient: LinearGradient(colors: [YELLOW, GREEN])), |
| 135 | + child: ListView( |
| 136 | + //crossAxisAlignment: CrossAxisAlignment.center, |
| 137 | + children: <Widget>[ |
| 138 | + TopTitleBar(), |
| 139 | + _feedCard(), |
| 140 | + ], |
| 141 | + ), |
| 142 | + ), |
| 143 | + ); |
| 144 | + } |
| 145 | +} |
0 commit comments