import 'dart:math';
import 'package:app_with_bloc/util/MyScreenUtil.dart';
import 'package:flutter/material.dart';
class AppBar extends StatefulWidget implements PreferredSizeWidget {
GlobalKey scaffoldKey;
// AppBar(this.scaffoldKey, {Key key}) : preferredSize = Size.fromHeight(kToolbarHeight), super(key: key);
AppBar(this.scaffoldKey, {Key key})
: preferredSize = Size.fromHeight(max(MyScreenUtil().getScaledSize(kToolbarHeight), kToolbarHeight)),
super(key: key);
@override
final Size preferredSize; // default is 56.0
@override
_AppBarState createState() => _AppBarState();
}
class _AppBarState extends State {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.blue,
child: SafeArea(
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [
Padding(
padding: EdgeInsets.only(bottom: MyScreenUtil().getScaledSize(4.0), left: MyScreenUtil().getScaledSize(4.0), ),
child: IconButton(
icon: Icon(Icons.menu, size: MyScreenUtil().getScaledSize(26), color: Colors.white), // change this size and style
onPressed: () => widget.scaffoldKey.currentState.openDrawer(),
),
),
Padding(
padding: EdgeInsets.all(MyScreenUtil().getScaledSize(8.0)),
child: Text('Start', style: Theme.of(context).textTheme.title.apply(fontSizeFactor: 1.4, color: Colors.white)),
),
Padding(
padding: EdgeInsets.only(bottom: MyScreenUtil().getScaledSize(4.0), right: MyScreenUtil().getScaledSize(4.0), ),
child: IconButton(
icon: Icon(Icons.menu, size: MyScreenUtil().getScaledSize(26), color: Colors.white),
),
),
]
),
),
);
}
}