Skip to content

Commit

Permalink
Merge pull request himanshusharma89#61 from diksh735/dummy
Browse files Browse the repository at this point in the history
App Drawer Added
  • Loading branch information
himanshusharma89 authored Mar 8, 2021
2 parents 45638bb + e99848a commit 93e63f1
Showing 1 changed file with 223 additions and 124 deletions.
347 changes: 223 additions & 124 deletions lib/views/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,137 +4,150 @@ import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/widgets/retro_button.dart';

class Home extends StatelessWidget {

final GlobalKey<ScaffoldState> _drawerKey = GlobalKey();

void _openDrawer () {
_drawerKey.currentState.openDrawer();
}

@override
Widget build(BuildContext context) {
final height = MediaQuery.of(context).size.height;
final width = MediaQuery.of(context).size.width;
return SingleChildScrollView(
primary: true,
child: Container(
width: width,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: height * 0.01,
),
Container(
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
RetroButton(
child: Icon(Icons.menu),
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
borderColor: Colors.white,
),
RetroButton(
child: Padding(
padding: const EdgeInsets.only(top: 7, left: 6),
child: Icon(
RelicIcons.cart,
size: 32,
return Scaffold(
key: _drawerKey,
drawer: DrawerWidget(),
body:SingleChildScrollView(
primary: true,
child: Container(
width: width,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: height * 0.01,
),
Container(
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
child: RetroButton(
child: Icon(Icons.menu),
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
borderColor: Colors.white,
),
onTap: (){_openDrawer();},
),
),
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
borderColor: Colors.white,
RetroButton(
child: Padding(
padding: const EdgeInsets.only(top: 7, left: 6),
child: Icon(
RelicIcons.cart,
size: 32,
),
),
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
borderColor: Colors.white,
),
],
),
],
),
),
SizedBox(
height: height * 0.03,
),
Text.rich(
TextSpan(
style: TextStyle(
fontFamily: 'pixer',
fontSize: 16,
color: Colors.white,
height: 1.3829787234042554,
shadows: [
Shadow(
color: RelicColors.secondaryBlack,
offset: Offset(0, 3),
blurRadius: 6,
)
],
),
children: [
TextSpan(
text: 'GOOD EVENING,\n',
),
SizedBox(
height: height * 0.03,
),
Text.rich(
TextSpan(
text: 'LINUS!',
style: TextStyle(
fontFamily: 'Pixer',
fontSize: 47,
),
),
],
),
textAlign: TextAlign.left,
),
SizedBox(
height: height * 0.02,
),
searchBar(context),
SizedBox(
height: height * 0.02,
),
Container(
height: height * 1.08,
width: width,
child: Stack(
children: <Widget>[
Container(
width: width * 0.9,
// height: 729.0,
decoration: BoxDecoration(
color: RelicColors.primaryBlack,
fontFamily: 'pixer',
fontSize: 16,
color: Colors.white,
height: 1.3829787234042554,
shadows: [
Shadow(
color: RelicColors.secondaryBlack,
offset: Offset(0, 3),
blurRadius: 6,
)
],
),
children: [
TextSpan(
text: 'GOOD EVENING,\n',
),
TextSpan(
text: 'LINUS!',
style: TextStyle(
fontFamily: 'Pixer',
fontSize: 47,
),
),
],
),
Transform.translate(
offset: Offset(10, 10),
child: Container(
width: width * 0.9,
// height: 729.0,
decoration: BoxDecoration(
color: Colors.white,
textAlign: TextAlign.left,
),
SizedBox(
height: height * 0.02,
),
searchBar(context),
SizedBox(
height: height * 0.02,
),
Container(
height: height * 1.08,
width: width,
child: Stack(
children: <Widget>[
Container(
width: width * 0.9,
// height: 729.0,
decoration: BoxDecoration(
color: RelicColors.primaryBlack,
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: GridView.builder(
primary: false,
physics: NeverScrollableScrollPhysics(),
gridDelegate:
Transform.translate(
offset: Offset(10, 10),
child: Container(
width: width * 0.9,
// height: 729.0,
decoration: BoxDecoration(
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: GridView.builder(
primary: false,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 8,
mainAxisSpacing: 8,
childAspectRatio: 1/1.6),
itemCount: productsList.length,
itemBuilder: (_, index) =>
itemCount: productsList.length,
itemBuilder: (_, index) =>
productsList[index])),
),
),
),
],
),
],
),
),
SizedBox(
height: height * 0.1,
),
SizedBox(
height: height * 0.1,
),
],
),
],
),
),
),
)
),
);
}
Expand Down Expand Up @@ -164,19 +177,19 @@ class Home extends StatelessWidget {
Icon(RelicIcons.search),
Expanded(
child: TextFormField(
style: TextStyle(
fontFamily: 'pix M 8pt',
fontSize: 16,
color: RelicColors.primaryBlack,
),
decoration: InputDecoration(
hintText: 'search for categories, items and more...',
border: InputBorder.none,
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
)),
)),
style: TextStyle(
fontFamily: 'pix M 8pt',
fontSize: 16,
color: RelicColors.primaryBlack,
),
decoration: InputDecoration(
hintText: 'search for categories, items and more...',
border: InputBorder.none,
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
)),
)),
// Text(
// 'search for categories, items and more...',
// style: TextStyle(
Expand All @@ -195,3 +208,89 @@ class Home extends StatelessWidget {
);
}
}

class DrawerWidget extends StatelessWidget {
const DrawerWidget({
Key key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.only(top: 20.0),
children: <Widget>[
_createDrawerItem(
icon: Icons.person,
title: 'ABOUT',
onTap: () {}
),
_createDrawerItem(
icon: Icons.shopping_cart,
title: 'CART',
onTap: () {},
),
_createDrawerItem(
icon: Icons.list,
title: 'WISHLIST',
onTap: () {},
),
_createDrawerItem(
icon: Icons.category,
title: 'PRODUCTS',
onTap: () {},
),
_createDrawerItem(
icon: Icons.logout,
title: 'LOG OUT',
onTap: () {},
),
],
),
);
}
}



Widget _createDrawerItem(
{IconData icon,
String title,
GestureTapCallback onTap}) {
return ListTile(
title: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Icon(
icon,
color: RelicColors.backgroundColor,
size: 40.0,
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 12.0,
vertical: 30.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
title,
style: TextStyle(
fontFamily: 'Pixer',
color: RelicColors.backgroundColor,
fontSize: 18.0,
),
),
],
),
),
)
],
),
onTap: onTap,
);
}

0 comments on commit 93e63f1

Please sign in to comment.