class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton( // Пытался тута
icon: Icon(Icons.apps_sharp),
onPressed: () => Scaffold.of(context).openDrawer();
),
backgroundColor: Colors.white,
iconTheme: IconThemeData(
color: Colors.cyan[800], //change your color here
),
title: Text(
'AkepBersh',
style: TextStyle(color: Colors.cyan[800], fontFamily: 'Lobster'),
),
actions: [],
),
drawer: Drawer(
child: ListView(
children: [
UserAccountsDrawerHeader(
accountName: Text('Name'),
accountEmail: Text('example@gmail.com'))
],
),
),
);
}
}
Scaffold.of() called with a context that does not contain a Scaffold.
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
leading: Builder(
builder: (context) {
return IconButton(
icon: Icon(Icons.clear),
onPressed: () => Scaffold.of(context).openDrawer(),
);
},
),
backgroundColor: Colors.white,
iconTheme: IconThemeData(
color: Colors.cyan[800], //change your color here
),
title: Text(
'AkepBersh',
style: TextStyle(color: Colors.cyan[800], fontFamily: 'Lobster'),
),
actions: [],
),
drawer: Drawer(
child: ListView(
children: [
UserAccountsDrawerHeader(
accountName: Text('Name'),
accountEmail: Text('example@gmail.com'))
],
),
),
),
);
}
}