mod: android/iOS配置文件、mainApp页面

This commit is contained in:
guozhigq
2023-04-18 11:43:03 +08:00
parent 13aab2e20f
commit efa257b175
9 changed files with 205 additions and 7 deletions

View File

@ -1,4 +1,7 @@
import 'package:flutter/material.dart';
import 'package:pilipala/pages/home/view.dart';
import 'package:pilipala/pages/hot/view.dart';
import 'package:pilipala/pages/mine/view.dart';
class MainApp extends StatefulWidget {
const MainApp({super.key});
@ -8,11 +11,47 @@ class MainApp extends StatefulWidget {
}
class _MainAppState extends State<MainApp> {
int selectedIndex = 0;
void setIndex(int value) {
if (selectedIndex != value) {
selectedIndex = value;
setState(() {});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('main'),
body: IndexedStack(
index: selectedIndex,
children: const [
HomePage(),
HotPage(),
MinePage(),
],
),
bottomNavigationBar: NavigationBar(
elevation: 1,
destinations: const [
NavigationDestination(
icon: Icon(Icons.home_outlined),
selectedIcon: Icon(Icons.home),
label: "推荐",
),
NavigationDestination(
icon: Icon(Icons.whatshot_outlined),
selectedIcon: Icon(Icons.whatshot_rounded),
label: "热门",
),
NavigationDestination(
icon: Icon(Icons.person_outline),
label: "我的",
selectedIcon: Icon(Icons.person),
),
],
selectedIndex: selectedIndex,
onDestinationSelected: (value) => setIndex(value),
),
);
}