1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| import 'package:flutter/material.dart'; import 'package:go_mood/widgets/custom_dropdown_button.dart';
class HomePage extends StatelessWidget { late double _deviceHeight, _deviceWidth; HomePage({super.key});
@override Widget build(BuildContext context) { _deviceHeight = MediaQuery.of(context).size.height; _deviceWidth = MediaQuery.of(context).size.width; return Scaffold( body: SafeArea( child: Container( height: _deviceHeight, width: _deviceWidth, padding: EdgeInsets.symmetric(horizontal: _deviceWidth * 0.05), child: Stack( children: [ Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start, children: [ _pageTitle(), _bookRideWidget(), ], ), Align( alignment: Alignment.centerRight, child: _astroImageWidget(), ), ], ), ) ), ); }
Widget _pageTitle() { return Text( "#GoMoon", style: TextStyle( color: Colors.white, fontSize: 60, fontWeight: FontWeight.w800, ) ); }
Widget _astroImageWidget() { return Container( height: _deviceHeight * 0.50, width: _deviceWidth * 0.65, decoration: const BoxDecoration( image: DecorationImage( fit: BoxFit.fill, image: AssetImage("assets/images/astro_moon.png"), ), ), ); }
Widget _bookRideWidget() { return Container( height: _deviceHeight * 0.25, child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ _destionationDropDownWidget(), _travellersInformationWidget(), _rideButton(), ], ) ); }
Widget _destionationDropDownWidget() { return CustomDropDownButtonClass( values: const [ 'James Webb Station', 'Preneure Station', ], width: _deviceWidth, ); }
Widget _travellersInformationWidget() { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ CustomDropDownButtonClass( values: const [ '1', '2', '3', '4', ], width: _deviceWidth * 0.45, ), CustomDropDownButtonClass( values: const [ 'Economy', 'Business', 'First', 'Private', ], width: _deviceWidth * 0.4, ), ], ); }
Widget _rideButton( ){ return Container( margin: EdgeInsets.only(bottom: _deviceHeight * 0.01), width: _deviceWidth, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), ), child: MaterialButton( onPressed: (){}, child: const Text( "Book Ride!", style: TextStyle( color: Colors.black, ) ), ), ); } }
|