Robo-advisory-dart/lib/widgets/drawer.dart

163 lines
4.3 KiB
Dart
Raw Permalink Normal View History

import 'package:flutter/material.dart';
import 'package:robo_advisory/theme/icons.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:robo_advisory/config/Routes.dart';
class AppDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Drawer(
child: Container(
color: Color(0xFFB0B0B0),
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
_createHeader(),
Center(
child: SvgPicture.asset(
plusIcon,
color: Color(0xFF2F2F2F),
height: 25.0,
),
),
Divider(),
SizedBox(
height: 30.0,
),
_createDrawerItem(
icon: shareIcon,
text: 'Send Money',
onTap: () => print('contact'),
),
_createDrawerItem(
icon: currencyIcon,
text: 'Pay Bills',
onTap: () => print('Events'),
),
_createDrawerItem(
icon: reloadIcon,
text: 'Convert',
onTap: () => print('Notes'),
),
SizedBox(
height: 30.0,
),
_createDrawerItem(
icon: accountIcon,
text: 'Account',
2022-09-11 14:37:28 +00:00
onTap: () {},
),
_createDrawerItem(
icon: logoutIcon,
text: 'Logout',
onTap: () => Navigator.pushNamed(context, Routes.login),
),
ListTile(
title: Text('0.0.1'),
onTap: () {},
),
],
),
),
);
}
Widget _createHeader() {
return DrawerHeader(
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
child: Stack(
children: <Widget>[
Positioned(
bottom: 12.0,
left: 16.0,
child: Column(
children: [
Row(
children: [
CircleAvatar(
backgroundColor: Color(0xFF5F5F5F),
),
SizedBox(
width: 20.0,
),
Text(
'Johne doe 01',
style: GoogleFonts.inter(
textStyle: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 23,
color: Colors.black,
),
),
),
],
),
SizedBox(
height: 10.0,
),
Row(
children: [
CircleAvatar(
backgroundColor: Color(0xFF5F5F5F),
),
SizedBox(
width: 20.0,
),
Text(
'Johne doe 02',
style: GoogleFonts.inter(
textStyle: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 23,
color: Colors.black,
),
),
),
],
),
],
),
),
],
),
);
}
Widget _createDrawerItem(
2022-09-11 14:37:28 +00:00
{required String icon, required String text, required GestureTapCallback onTap}) {
return ListTile(
title: Row(
children: <Widget>[
SizedBox(
width: 30.0,
child: SvgPicture.asset(
icon,
color: Color(0xFF2F2F2F),
height: 25.0,
),
),
SizedBox(
width: 20.0,
),
Padding(
padding: EdgeInsets.only(left: 8.0),
child: Text(
text,
style: GoogleFonts.inter(
textStyle: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 15,
color: Colors.black,
),
),
),
)
],
),
onTap: onTap,
);
}
}