import 'package:flutter/cupertino.dart';标签:const,Icons,title,dart,5.27,import,icon From: https://www.cnblogs.com/kongxiangzeng/p/18246574
import 'package:flutter/material.dart';
import 'package:test1/page/video.dart';
import '../component/container.dart';
import '../component/drawer.dart';
import 'openAL.dart';
import 'column.dart';
import 'login.dart';
import 'package:test1/page/Special_Column.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
// 每个项目最外层,必须有MaterialApp
@override
Widget build(BuildContext context) {
return MaterialApp(
title: '心语航标',
theme: ThemeData(
primarySwatch: Colors.purple,
),
// 通过Home 指定首页
home: const MyHome(),
);
}
}
class MyHome extends StatelessWidget {
const MyHome({super.key});
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 4,
child: Scaffold(
appBar: AppBar(
title: const Text('心语航标'),
centerTitle: true,
actions: <Widget>[
IconButton(
icon: const Icon(Icons.search),
onPressed: () {
// 在这里放置搜索操作的代码
},
)
],
),
drawer: buildCustomDrawer(
accountEmail: '',
accountName: '未登录',
currentAccountPictureAsset: 'assets/阿尼亚.jpg',
drawerBackgroundAsset: 'assets/可可爱爱阿尼亚.jpg',
drawerItems: [
DrawerItem(title: '用户反馈', icon: Icons.feedback),
DrawerItem(title: '系统设置', icon: Icons.settings),
DrawerItem(title: '我要发布', icon: Icons.send),
DrawerItem(title: '注销', icon: Icons.exit_to_app),
],
onLoginPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => LoginPage(key: UniqueKey())),
);
},
),
bottomNavigationBar: buildCustomBottomNavigationBar(
tabs: [
const Tab(icon: Icon(Icons.home), text: '首页'),
const Tab(icon: Icon(Icons.article), text: '专栏'),
const Tab(icon: Icon(Icons.chat_bubble), text: 'AL咨询'),
const Tab(icon: Icon(Icons.notifications), text: '消息'),
],
backgroundColor: Colors.black, // 指定背景颜色
height: 60.0, // 指定高度
labelStyle: const TextStyle(height: 0, fontSize: 12), // 指定文本样式
), // 添加逗号
body: TabBarView(
children: <Widget>[
Text('data1'),
ColumnPage1(),
ChatDialog(),
ColumnPage(),
],
),
),
);
}
}