class MyApp extends StatefulWidget {
@override
myAppState createState() => myAppState();
}
class myAppState extends State<MyApp> {
//目前選擇頁索引值
int currentIndex = 0; //預設值
final pages = [One(), Two(), Three()];
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(
title: Text('DrawerDemo'),
),
drawer: Drawer(
child: ListView(
children: <Widget>[
const DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Text('Drawer Header'),
),
//選單
ListTile(
leading: new CircleAvatar(child: Icon(your_icon)),
title: Text('第一頁'),
onTap: () {
itemClick(0);
},
),
ListTile(
leading: new CircleAvatar(child: Icon(your_icon)),
title: Text('第二頁'),
onTap: () {
itemClick(1);
},
),
ListTile(
leading: new CircleAvatar(child: Icon(your_icon)),
title: Text('第三頁'),
onTap: () {
itemClick(2);
},
),
],
),
),
body: pages[currentIndex],
);
}
void itemClick(int index) {
setState(() {
currentIndex = index;
Navigator.of(context).pop();
});
}
}
[Flutter]Drawer
更新於 發佈於 閱讀時間約 3 分鐘
留言
留言分享你的想法!
小黑與程式的邂逅
8會員
123內容數
嗨,我是一名程式設計師,會在這分享開發與學習紀錄。
小黑與程式的邂逅的其他內容
2023/12/28
解析成List
List items=json.decode(jsonStr);
print(items[0]["your_key"]);
解析成Map
Map<String, dynamic> user = json.decode(json);
print('${user['your_k

2023/12/28
解析成List
List items=json.decode(jsonStr);
print(items[0]["your_key"]);
解析成Map
Map<String, dynamic> user = json.decode(json);
print('${user['your_k

2023/12/26
這邊會使用WebSocketChannel去與http://www.websocket.org做連線。
連線
final channel = IOWebSocketChannel.connect('wss://echo.websocket.events');
接收
StreamBui

2023/12/26
這邊會使用WebSocketChannel去與http://www.websocket.org做連線。
連線
final channel = IOWebSocketChannel.connect('wss://echo.websocket.events');
接收
StreamBui

2023/12/26
Dio是一個Dart Http請求庫,支援Restful API、FormData、攔截器、請求取消、Cookie管理、檔案上傳/下載、逾時等。
加入
dependencies:
dio: ^x.x.x #请使用pub上的最新版本
使用
GET
Response response;

2023/12/26
Dio是一個Dart Http請求庫,支援Restful API、FormData、攔截器、請求取消、Cookie管理、檔案上傳/下載、逾時等。
加入
dependencies:
dio: ^x.x.x #请使用pub上的最新版本
使用
GET
Response response;

你可能也想看














創作者營運專員/經理(Operations Specialist/Manager)將負責對平台成長及收入至關重要的 Partnership 夥伴創作者開發及營運。你將發揮對知識與內容變現、影響力變現的精準判斷力,找到你心中的潛力新星或有聲量的中大型創作者加入 vocus。

創作者營運專員/經理(Operations Specialist/Manager)將負責對平台成長及收入至關重要的 Partnership 夥伴創作者開發及營運。你將發揮對知識與內容變現、影響力變現的精準判斷力,找到你心中的潛力新星或有聲量的中大型創作者加入 vocus。
# 簡介
身為一位專注於 Vue.js 的前端開發者,這是我第一次嘗試構建 Flutter 網頁應用。讓我們開始吧!
## 第一次嘗試
### 第一步:創建一個 Flutter 應用
首先,通過運行以下命令來創建一個新的 Flutter 項目:
```sh
flutter
# 簡介
身為一位專注於 Vue.js 的前端開發者,這是我第一次嘗試構建 Flutter 網頁應用。讓我們開始吧!
## 第一次嘗試
### 第一步:創建一個 Flutter 應用
首先,通過運行以下命令來創建一個新的 Flutter 項目:
```sh
flutter

本篇文章將分享手機App設計教學,並往後介紹使用Flutter開發App的相關知識和技巧。透過這系列的分享,讀者將能夠學習如何利用設計和程式開發技能來製作一個App。文章中也提供了一些靈感來源和教學資源,幫助讀者進行設計和開發的思考和學習。

本篇文章將分享手機App設計教學,並往後介紹使用Flutter開發App的相關知識和技巧。透過這系列的分享,讀者將能夠學習如何利用設計和程式開發技能來製作一個App。文章中也提供了一些靈感來源和教學資源,幫助讀者進行設計和開發的思考和學習。

GestureDetector
onTap、onDoubleTap和onLongPress
class _GestureTestState extends State<GestureTest> {
String _operation = "No detected!"; //事件名稱
@o

GestureDetector
onTap、onDoubleTap和onLongPress
class _GestureTestState extends State<GestureTest> {
String _operation = "No detected!"; //事件名稱
@o

新增video_player
在pubspec.yaml中加入video_player。
設置權限
Android
在AndroidManifest.xml檔案中的<application>裡,加入下列代碼。
<uses-permission android:name="androi

新增video_player
在pubspec.yaml中加入video_player。
設置權限
Android
在AndroidManifest.xml檔案中的<application>裡,加入下列代碼。
<uses-permission android:name="androi

首先需要在pubspec.yaml文件中添加依賴。
宣告
SharedPreferences record = await SharedPreferences.getInstance();
寫入
//字串資料
await record.setString(key, value);
//

首先需要在pubspec.yaml文件中添加依賴。
宣告
SharedPreferences record = await SharedPreferences.getInstance();
寫入
//字串資料
await record.setString(key, value);
//

Container
child:可以設定一個子元件
Container(child:Text('child'));
color:背景顏色
Container(color: Color.fromARGB(255, 255, 255, 255));
alignment:對齊方式
Co

Container
child:可以設定一個子元件
Container(child:Text('child'));
color:背景顏色
Container(color: Color.fromARGB(255, 255, 255, 255));
alignment:對齊方式
Co