import 'package:flutter/material.dart'; import 'package:flutter_slider_drawer/flutter_slider_drawer.dart'; import 'main_widget.dart'; import 'menu_widget.dart'; void main() { runApp(MyApp()); } class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { GlobalKey _key = new GlobalKey(); String title; @override void initState() { title = "Home"; super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( body: SliderMenuContainer( appBarColor: Colors.white, key: _key, sliderMenuOpenSize: 200, title: Text( title, style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700), ), sliderMenu: MenuWidget( onItemClick: (title) { _key.currentState.closeDrawer(); setState(() { this.title = title; }); }, ), sliderMain: MainWidget()), ), ); } }