mod: android/iOS配置文件、mainApp页面
This commit is contained in:
@ -12,7 +12,7 @@ class _HomePageState extends State<HomePage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('home'),
|
||||
title: const Text('推荐'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ class _HotPageState extends State<HotPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('hot'),
|
||||
title: const Text('热门'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ class _MinePageState extends State<MinePage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('mine'),
|
||||
title: const Text('我的'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user