在创建主题时:
appBarTheme: new AppBarTheme(
iconTheme: base.appBarTheme.iconTheme.copyWith(size: 100, color: Colors.red),
//Color is working but size having no effect*
),
答案 0 :(得分:2)
更改汉堡菜单的最简单方法是从 AppBar
更改leading
小部件
final _scaffoldKey = new GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.menu, size: 40), // change this size and style
onPressed: () => _scaffoldKey.currentState.openDrawer(),
),
title: Text('Home Screen'),
),
body: Container(),
drawer: Container(
width: 300,
color: Colors.white,
),
);
}
此更改将创建一个巨大的汉堡菜单:
答案 1 :(得分:0)
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), ), ), ] ), ), ); } }