home_page.dart 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. class HomePage extends StatefulWidget {
  4. @override
  5. _HomePageState createState() => _HomePageState();
  6. }
  7. class _HomePageState extends State<HomePage> {
  8. Map<String, IconData> map = {
  9. "Every 7 days": Icons.timelapse,
  10. "Needs sun": Icons.wb_sunny,
  11. "Minimum of 1°C": Icons.whatshot
  12. };
  13. int selectedSizeIndex = 0;
  14. List<String> sizeList = ["10\"", "15\"", "20\"", "25\""];
  15. Widget sizeWidget(int index) {
  16. return GestureDetector(
  17. onTap: () {
  18. selectedSizeIndex = index;
  19. setState(() {});
  20. },
  21. child: Container(
  22. width: 84,
  23. height: 84,
  24. margin: EdgeInsets.only(right: 20),
  25. decoration: BoxDecoration(
  26. color: selectedSizeIndex == index ? Colors.white : Color(0xFF0f323b),
  27. borderRadius: BorderRadius.circular(20),
  28. ),
  29. child: Center(
  30. child: Text(
  31. sizeList[index],
  32. style: TextStyle(
  33. color: selectedSizeIndex == index
  34. ? Color(0xFF234e51)
  35. : Color(0xFF68a9bb),
  36. fontSize: 23,
  37. fontWeight: FontWeight.bold),
  38. ),
  39. ),
  40. ),
  41. );
  42. }
  43. Widget getDetails(String text, int color) {
  44. return Container(
  45. height: 36,
  46. padding: EdgeInsets.symmetric(horizontal: 3),
  47. decoration: BoxDecoration(
  48. color: Color(color), borderRadius: BorderRadius.circular(11)),
  49. child: Center(
  50. child: Text(
  51. text,
  52. style: TextStyle(color: Colors.white, fontSize: 17),
  53. ),
  54. ),
  55. );
  56. }
  57. Widget getRows(String key) {
  58. return Padding(
  59. padding: EdgeInsets.only(bottom: 5),
  60. child: Row(
  61. mainAxisAlignment: MainAxisAlignment.start,
  62. children: <Widget>[
  63. Icon(
  64. map[key],
  65. size: 28,
  66. color: Color(0xFF7bb06d),
  67. ),
  68. SizedBox(width: 10),
  69. Text(
  70. key,
  71. style: TextStyle(color: Color(0xFFd8e8eb), fontSize: 20),
  72. ),
  73. ],
  74. ),
  75. );
  76. }
  77. @override
  78. Widget build(BuildContext context) {
  79. return MaterialApp(
  80. debugShowCheckedModeBanner: false,
  81. home: Scaffold(
  82. backgroundColor: Colors.white,
  83. body: AnnotatedRegion<SystemUiOverlayStyle>(
  84. value: SystemUiOverlayStyle.light,
  85. child: Container(
  86. width: double.infinity,
  87. height: double.infinity,
  88. child: Column(
  89. children: <Widget>[
  90. Expanded(
  91. flex: 7,
  92. child: ClipRRect(
  93. borderRadius: BorderRadius.only(
  94. bottomRight: Radius.circular(55),
  95. bottomLeft: Radius.circular(55)),
  96. child: Stack(
  97. children: <Widget>[
  98. Container(
  99. color: Color(0xFF091e25),
  100. child: Column(
  101. crossAxisAlignment: CrossAxisAlignment.start,
  102. children: <Widget>[
  103. Expanded(
  104. flex: 2,
  105. child: Container(
  106. alignment: Alignment.bottomLeft,
  107. padding:
  108. EdgeInsets.only(left: 20, bottom: 10),
  109. child: GestureDetector(
  110. onTap: () {
  111. Navigator.pop(context);
  112. },
  113. child: Icon(Icons.arrow_back,
  114. size: 40, color: Color(0xFF7ab06e)),
  115. ),
  116. ),
  117. ),
  118. Expanded(
  119. flex: 2,
  120. child: Container(
  121. child: Row(
  122. children: <Widget>[
  123. Expanded(
  124. flex: 5,
  125. child: Container(
  126. padding: EdgeInsets.only(left: 30),
  127. alignment: Alignment.centerLeft,
  128. child: Text(
  129. "Rubber Tree",
  130. overflow: TextOverflow.ellipsis,
  131. maxLines: 1,
  132. style: TextStyle(
  133. color: Colors.white,
  134. fontSize: 36,
  135. fontWeight: FontWeight.bold),
  136. ),
  137. ),
  138. ),
  139. Expanded(
  140. flex: 3,
  141. child: Container(),
  142. ),
  143. ],
  144. ),
  145. ),
  146. ),
  147. Expanded(
  148. flex: 2,
  149. child: Container(
  150. child: Row(
  151. children: <Widget>[
  152. Expanded(
  153. flex: 4,
  154. child: Container(
  155. padding: EdgeInsets.only(left: 30),
  156. alignment: Alignment.topLeft,
  157. child: Text(
  158. "Robust and dramatic, with glossy leaves",
  159. overflow: TextOverflow.ellipsis,
  160. maxLines: 3,
  161. style: TextStyle(
  162. color: Color(0xFFb0bcc1),
  163. fontSize: 22,
  164. ),
  165. ),
  166. ),
  167. ),
  168. Expanded(
  169. flex: 3,
  170. child: Container(),
  171. ),
  172. ],
  173. ),
  174. ),
  175. ),
  176. Expanded(
  177. flex: 2,
  178. child: Container(
  179. child: Row(
  180. children: <Widget>[
  181. Expanded(
  182. flex: 10,
  183. child: Container(
  184. margin: EdgeInsets.only(left: 30),
  185. child: Column(
  186. mainAxisAlignment:
  187. MainAxisAlignment.start,
  188. children: <Widget>[
  189. Row(
  190. mainAxisAlignment:
  191. MainAxisAlignment.start,
  192. children: <Widget>[
  193. Expanded(
  194. child: getDetails(
  195. "Easy to grow",
  196. 0xFF71a861),
  197. ),
  198. SizedBox(width: 10),
  199. Expanded(
  200. child: getDetails(
  201. "Air cleaner",
  202. 0xFF4f95a7),
  203. ),
  204. ],
  205. ),
  206. SizedBox(height: 10),
  207. Row(
  208. mainAxisAlignment:
  209. MainAxisAlignment.start,
  210. children: <Widget>[
  211. Expanded(
  212. child: getDetails(
  213. "Pet friendly",
  214. 0xFFa8a96b),
  215. ),
  216. SizedBox(width: 10),
  217. Expanded(
  218. child: getDetails(
  219. "26\"-38\"tall",
  220. 0xFF569476),
  221. ),
  222. ],
  223. ),
  224. ],
  225. ),
  226. ),
  227. ),
  228. Expanded(
  229. flex: 6,
  230. child: Container(),
  231. ),
  232. ],
  233. ),
  234. ),
  235. ),
  236. Expanded(
  237. flex: 3,
  238. child: Container(
  239. child: Row(
  240. children: <Widget>[
  241. Expanded(
  242. flex: 10,
  243. child: Container(
  244. margin: EdgeInsets.symmetric(
  245. vertical: 10),
  246. padding: EdgeInsets.only(
  247. top: 4, left: 40, bottom: 4),
  248. alignment: Alignment.topCenter,
  249. decoration: BoxDecoration(
  250. color: Color(0xFF0f323b),
  251. borderRadius: BorderRadius.only(
  252. topRight: Radius.circular(40),
  253. bottomRight:
  254. Radius.circular(40)),
  255. ),
  256. child: Column(
  257. mainAxisAlignment:
  258. MainAxisAlignment.spaceEvenly,
  259. children:
  260. map.entries.map((MapEntry map) {
  261. return getRows(map.key);
  262. }).toList(),
  263. ),
  264. ),
  265. ),
  266. Expanded(
  267. flex: 6,
  268. child: Container(),
  269. ),
  270. ],
  271. ),
  272. ),
  273. ),
  274. Expanded(
  275. flex: 3,
  276. child: Container(
  277. padding: EdgeInsets.only(
  278. left: 35, top: 10, bottom: 7),
  279. child: Column(
  280. mainAxisAlignment:
  281. MainAxisAlignment.spaceBetween,
  282. crossAxisAlignment:
  283. CrossAxisAlignment.start,
  284. children: <Widget>[
  285. Container(
  286. width: double.infinity,
  287. child: Text(
  288. "Choose the size",
  289. style: TextStyle(
  290. color: Colors.white,
  291. fontSize: 29,
  292. fontWeight: FontWeight.bold),
  293. ),
  294. ),
  295. Container(
  296. height: 80,
  297. child: ListView(
  298. scrollDirection: Axis.horizontal,
  299. children: sizeList
  300. .asMap()
  301. .entries
  302. .map((MapEntry map) {
  303. return sizeWidget(map.key);
  304. }).toList(),
  305. ),
  306. )
  307. ],
  308. ),
  309. ),
  310. ),
  311. Expanded(
  312. flex: 1,
  313. child: Container(),
  314. ),
  315. ],
  316. ),
  317. ),
  318. Container(
  319. width: double.infinity,
  320. height: double.infinity,
  321. child: Row(
  322. children: <Widget>[
  323. Expanded(
  324. flex: 5,
  325. child: Container(),
  326. ),
  327. Expanded(
  328. flex: 4,
  329. child: Container(
  330. child: Column(
  331. children: <Widget>[
  332. Expanded(
  333. flex: 1,
  334. child: Container(),
  335. ),
  336. Expanded(
  337. flex: 11,
  338. child: Container(
  339. alignment: Alignment.center,
  340. child: Stack(
  341. children: <Widget>[
  342. Positioned.directional(
  343. textDirection:
  344. TextDirection.ltr,
  345. start: -64,
  346. top: -156,
  347. child: Transform.scale(
  348. scale: 0.63,
  349. child: Image(
  350. image: AssetImage(
  351. "assets/images/plant.jpg"),
  352. ),
  353. ),
  354. ),
  355. ],
  356. ),
  357. ),
  358. ),
  359. Expanded(
  360. flex: 5,
  361. child: Container(),
  362. )
  363. ],
  364. ),
  365. ),
  366. )
  367. ],
  368. ),
  369. )
  370. ],
  371. ),
  372. ),
  373. ),
  374. Expanded(
  375. child: Container(
  376. child: Center(
  377. child: RichText(
  378. text: TextSpan(
  379. text: 'Add to Cart - ',
  380. style: TextStyle(
  381. color: Color(0xFF1c494b),
  382. fontSize: 28,
  383. fontWeight: FontWeight.bold),
  384. children: <TextSpan>[
  385. TextSpan(
  386. text: '\$55',
  387. style: TextStyle(
  388. color: Color(0xFF6aa558),
  389. ),
  390. ),
  391. ],
  392. ),
  393. ),
  394. ),
  395. ),
  396. ),
  397. ],
  398. ),
  399. ),
  400. ),
  401. ),
  402. );
  403. }
  404. }