Comments (6)
@zengchanghuan 我也是新手,共同学习哈,
我底部导肮的代码在这里 home_screen,
如果要改到左上角你可以找到对应的页面自行在顶部布局,布局相关请看这里 Widget 目录
或者使用 Material 风格的 AppBar、iOS 风格的 CupertinoNavigationBar 。
from mood-example.
请问我使用drawer这种方式后怎么样可以把侧边栏调出来呢?谢谢
return Scaffold(
appBar: AppBar(
title: const Text('trade club'),
),
drawer: SizedBox(
width: MediaQuery.of(context).size.width * 0.9,
child: const Profile(),
),
body: PageView(
controller: _pageViewController,
physics: const NeverScrollableScrollPhysics(),
children: _pages,
),
bottomNavigationBar: DecoratedBox(
decoration: BoxDecoration(
color:
appTheme.bottomNavigationBarTheme.backgroundColor ?? Colors.grey,
boxShadow: [
BoxShadow(color: Colors.black.withOpacity(0.04), blurRadius: 24),
],
),
child: SafeArea(
child: Stack(
// alignment: Alignment.centerLeft,
children: [
/// 菜单
TabBar(
enableFeedback: true,
padding: EdgeInsets.only(left: 40.w),
controller: _pageController,
indicatorColor: Colors.transparent,
labelStyle: TextStyle(
height: 0.5.h,
fontSize: 10.sp,
fontWeight: FontWeight.bold,
),
unselectedLabelStyle: TextStyle(
height: 0.5.h,
fontSize: 10.sp,
fontWeight: FontWeight.bold,
),
tabs: [
Tab(
key: const Key('tab_home'),
text: S.of(context).app_bottomNavigationBar_title_home,
icon: Icon(
Remix.home_line,
size: _tabIconSize,
),
),
Tab(
key: const Key('tab_mood'),
text: S.of(context).app_bottomNavigationBar_title_mood,
icon: Icon(
Remix.heart_3_line,
size: _tabIconSize,
),
),
Tab(
key: const Key('tab_statistic'),
text: S.of(context).app_bottomNavigationBar_title_statistic,
icon: Icon(
Remix.bar_chart_line,
size: _tabIconSize,
),
),
],
onTap: (value) {
switch (value) {
case 2:
// 统计菜单触发
statistic.init(context);
}
_pageViewController.jumpToPage(value);
setState(() {
_currentPage = value;
});
},
),
],
),
),
),
);
from mood-example.
直接隐藏掉下面的返回按钮一直可以调用侧边栏,大牛厉害
from mood-example.
这里有写 NavigationDrawer
给 Scaffold 赋值一个 key
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
......
Scaffold(
key: scaffoldKey,
drawer: ......
)
......
然后通过当前状态打开 Drawer: scaffoldKey.currentState!.openDrawer();
from mood-example.
方便留个二维码吗?请您喝杯咖啡
from mood-example.
谢谢😄~ 不用不用,记得多多看官方文档 https://flutter.cn/
from mood-example.
Related Issues (14)
- INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native HOT 3
- 关于放大系统字体导致的文字显示的问题 HOT 4
- 这个项目也太强了吧!! HOT 1
- 运行不成功 HOT 1
- 启动失败 HOT 15
- ios开启小程序报错 HOT 1
- 🤔️ 常见问题 HOT 2
- 背景图片 HOT 7
- 在安卓設備中運行出現白屏 HOT 16
- The method 'AppLifecycleListener' isn't defined for the type '_InitState'. HOT 2
- ios运行时报错"liblibweex" HOT 5
- 如何实现非内置 uni小程序集成方式:应用资源包(.wgt)可以选择从云端获取或共享文件等方式,宿主通过 uni小程序 SDK 的 API 调用 releaseWgtToRunPath 实现释放资源包集成 uni小程序 HOT 5
- flutter run 报错 (Apple M1) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mood-example.