gpt4 book ai didi

flutter - 将抽屉项目图标更改为向右摆动

转载 作者:行者123 更新时间:2023-12-03 04:21:09 24 4
gpt4 key购买 nike

我在 flutter 中使用了抽屉,并在用户端抽屉中更改了抽屉的方向,
但是我还需要将抽屉项目图标的方向更改为向右抖动,我该怎么办?
enter image description here

最佳答案

您可以使用ListTile小部件来实现
试试这个

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

void main() => runApp( HomeApp());

class HomeApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return new MaterialApp(
theme: new ThemeData(
primarySwatch: Colors.deepPurple,
brightness: Brightness.light,
accentColor: Colors.red),
home: new HomePage(),
);
}
}

class HomePage extends StatefulWidget {
@override
_HomePageScreen createState() => _HomePageScreen();
}

class _HomePageScreen extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Home"),
),
endDrawer: Drawer(
child: ListView(
padding: EdgeInsets.all(0.0),
children: <Widget>[
UserAccountsDrawerHeader(
accountName: Text("Nilesh Rathod"),
accountEmail: Text("nilesh@gmail.com"),
currentAccountPicture: CircleAvatar(
backgroundColor: Colors.white,
child: Text("Nilu"),
),
otherAccountsPictures: <Widget>[
CircleAvatar(
backgroundColor: Colors.white,
child: Text("Pilu"),
),
],
),
ListTile(
title: Text("Home"),
trailing: Icon(Icons.new_releases),
),
Divider(),
ListTile(
title: Text("Profile"),
trailing: Icon(Icons.person),
onTap: () => {},
),
Divider(),
ListTile(
title: Text("Tab Layout"),
trailing: Icon(Icons.person),
onTap: () => {},
),
Divider(),
ListTile(
title: Text("Comman View Demo"),
trailing: Icon(Icons.person),
onTap: () => {},
),
Divider(),
ListTile(
title: Text("Close"),
trailing: Icon(Icons.close),
onTap: () => Navigator.of(context).pop(),
),
],
),
),
body: Center(
child: Text("Home Screen"),
),
);
}
}
样本代码
enter image description here

关于flutter - 将抽屉项目图标更改为向右摆动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62551069/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com