Created
August 1, 2019 15:57
-
-
Save gladson/a76b932a73601392dd9337b6a3339b9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; | |
import 'package:lotuserpmobi/blocs/clients_bloc.dart'; | |
import 'package:lotuserpmobi/blocs/modules/submenu_cadastros_module.dart'; | |
import 'package:lotuserpmobi/future/clients_future.dart'; | |
import 'package:lotuserpmobi/pages/clientes/clientes.dart'; | |
class SubMenuCadastros extends StatefulWidget { | |
const SubMenuCadastros({ | |
Key key, | |
this.closeDrawer | |
}) : super(key: key); | |
final VoidCallback closeDrawer; | |
@override | |
_SubMenuCadastrosState createState() => _SubMenuCadastrosState(); | |
} | |
class _SubMenuCadastrosState extends State<SubMenuCadastros> { | |
final double fontsize = 15; | |
final clientsBlocController = SubMenuCadastrosModule.to.getBloc<ClientsBlocController>(); | |
void getClients() { | |
// final ClientsBlocController clientsBlocController = BlocProvider.getBloc<ClientsBlocController>(); | |
clientsBlocController.clear(); | |
clientsBlocController.addFutureList(fetchClients()); | |
} | |
@override | |
void initState() { | |
super.initState(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return ExpansionTile( | |
title: Row( | |
children: <Widget>[ | |
Icon( | |
FontAwesomeIcons.addressCard, | |
size: 30, | |
), | |
SizedBox( | |
width: 25, | |
), | |
Padding( | |
padding: EdgeInsets.only(top: 5), | |
child: Text( | |
"Cadastros", | |
style: TextStyle( | |
fontSize: fontsize, | |
inherit: true | |
), | |
), | |
) | |
], | |
), | |
children: <Widget>[ | |
Divider(), | |
ListTile( | |
title: Row( | |
children: <Widget>[ | |
Icon( | |
Icons.subdirectory_arrow_right, | |
size: 30, | |
), | |
SizedBox( | |
width: 25, | |
), | |
Padding( | |
padding: EdgeInsets.only(top: 5), | |
child: Text( | |
"Clientes", | |
style: TextStyle( | |
fontSize: fontsize, | |
inherit: true | |
), | |
), | |
) | |
], | |
), | |
onTap: () { | |
print("clientes"); | |
widget.closeDrawer(); | |
getClients(); | |
Navigator.of(context).push( | |
MaterialPageRoute( | |
builder: (BuildContext context) => Clientes() | |
) | |
); | |
}, | |
), | |
Divider(), | |
ListTile( | |
title: Row( | |
children: <Widget>[ | |
Icon( | |
Icons.subdirectory_arrow_right, | |
size: 30, | |
), | |
SizedBox( | |
width: 25, | |
), | |
Padding( | |
padding: EdgeInsets.only(top: 5), | |
child: Text( | |
"Produtos", | |
style: TextStyle( | |
fontSize: fontsize, | |
inherit: true | |
), | |
), | |
) | |
], | |
), | |
onTap: () { | |
print("produtos"); | |
}, | |
), | |
], | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:bloc_pattern/bloc_pattern.dart'; | |
import 'package:lotuserpmobi/blocs/clients_bloc.dart'; | |
import 'package:lotuserpmobi/pages/home/submenu_cadastros.dart'; | |
class SubMenuCadastrosModule extends ModuleWidget { | |
@override | |
List<Bloc> get blocs => [ | |
Bloc((i) => ClientsBlocController()), | |
]; | |
@override | |
List<Dependency> get dependencies => [ | |
//Dependency((i) => AuthRepository()), | |
]; | |
@override | |
Widget get view => SubMenuCadastros(); | |
static Inject get to => Inject<SubMenuCadastrosModule>.of(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment