update
This commit is contained in:
parent
2992f4f408
commit
4f46de8d00
3330 changed files with 394553 additions and 76939 deletions
96
.config/Code/User/History/-2e064889/zkFb.dart
Normal file
96
.config/Code/User/History/-2e064889/zkFb.dart
Normal file
|
@ -0,0 +1,96 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
void main(){
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget{
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context){
|
||||
return ChangeNotifierProvider(
|
||||
create: (context) => MyAppState(),
|
||||
child: MaterialApp(
|
||||
title: 'First App',
|
||||
theme: ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.green)
|
||||
),
|
||||
home: const MyHomePage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyAppState extends ChangeNotifier{
|
||||
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget{
|
||||
const MyHomePage({super.key});
|
||||
|
||||
@override
|
||||
State<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage>{
|
||||
|
||||
var counter = 0;
|
||||
var selectedIndex = 0;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context){
|
||||
var sCount = counter.toString();
|
||||
|
||||
Widget page;
|
||||
switch(selectedIndex){
|
||||
case 0: page = MyHomePage();
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
body: Row(
|
||||
children: [
|
||||
SafeArea(
|
||||
child: NavigationRail(
|
||||
destinations: const [
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.home),
|
||||
label: Text('Home'),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.favorite),
|
||||
label: Text('Favorites'),
|
||||
),
|
||||
],
|
||||
selectedIndex: selectedIndex,
|
||||
onDestinationSelected: (value) => setState((){
|
||||
selectedIndex = value;
|
||||
}),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text('count: $sCount'),
|
||||
ElevatedButton(
|
||||
onPressed: () => {
|
||||
setState((){
|
||||
counter++;
|
||||
})
|
||||
},
|
||||
child: const Text('Increment')
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue