我希望导航栏内部容器占据屏幕宽度的80% ......这在AppBar Widget中可行吗?这意味着我希望右边的汉堡包图标(由endDrawer生成)向左移动10%
import 'package:flutter/material.dart';
class Navbar extends StatefulWidget {
const Navbar({Key? key, required this.child}) : super(key: key);
final Widget child;
@override
State<Navbar> createState() => _NavbarState();
}
class _NavbarState extends State<Navbar> {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return Scaffold(
key: scaffoldKey,
endDrawer: Drawer(
backgroundColor: kYellowColor,
child: Column(
children: [
Text('Form'),
Text('Receipt'),
],
),
),
appBar: AppBar(
backgroundColor: kYellowColor,
iconTheme: const IconThemeData(color: kBlackColor),
automaticallyImplyLeading: false,
),
body: widget.child,
);
}
}
这是当前的导航栏
1条答案
按热度按时间jq6vz3qz1#
您可以使用
PreferredSizeWidget
创建自定义应用栏。和通过尺寸