import 'package:flutter/material.dart'; import 'package:flutter_slider_drawer/flutter_slider_drawer.dart'; import 'dart:async'; 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, appBarPadding: const EdgeInsets.only(top: 20), sliderMenuOpenOffset: 250, appBarHeight: 60, title: Text( title, style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700), ), sliderMenuWidget: MenuWidget( onItemClick: (title) { _key.currentState.closeDrawer(); setState(() { this.title = title; }); }, ), sliderMainWidget: MainWidget()), ), ); } }