This commit is contained in:
parent
6eb6f9809e
commit
511e8cda76
9 changed files with 204 additions and 40 deletions
63
lib/page/more_page.dart
Normal file
63
lib/page/more_page.dart
Normal file
|
@ -0,0 +1,63 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:simple_git/resources/colors_schemes/lib_color_schemes.g.dart';
|
||||
|
||||
import 'about_page.dart';
|
||||
import 'settings_page.dart';
|
||||
|
||||
class MorePage extends StatefulWidget {
|
||||
const MorePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<MorePage> createState() => _MorePageState();
|
||||
}
|
||||
|
||||
class _MorePageState extends State<MorePage> {
|
||||
final _texts = [
|
||||
"Settings",
|
||||
"About",
|
||||
];
|
||||
|
||||
final _icons = [
|
||||
Icons.settings_outlined,
|
||||
Icons.info_outline,
|
||||
];
|
||||
|
||||
final _pages = [
|
||||
SettingsPage(),
|
||||
AboutPage(),
|
||||
];
|
||||
|
||||
int stateIndex = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('More',
|
||||
style: TextStyle(color: lightColorScheme.onPrimaryContainer)),
|
||||
backgroundColor: lightColorScheme.primaryContainer,
|
||||
elevation: 0,
|
||||
),
|
||||
body: ListView.builder(
|
||||
// padding: const EdgeInsets.all(20.0),
|
||||
itemCount: _texts.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
onTap: () => selectOption(index),
|
||||
title: Text(_texts[index]),
|
||||
leading: Icon(_icons[index], color: lightColorScheme.primary),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
selectOption(index) {
|
||||
stateIndex = index;
|
||||
Navigator.of(context).push(PageRouteBuilder(
|
||||
pageBuilder: (context, animation, secondaryAnimation) => _pages[index],
|
||||
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
|
||||
transitionDuration: const Duration(milliseconds: 150),
|
||||
));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue