feat(ui_kit): update example with drawer and custom launch parameters
This commit is contained in:
@@ -36,38 +36,43 @@ class Buttons extends StatelessWidget {
|
||||
const Buttons({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
Widget build(BuildContext context) => ListView(
|
||||
children: [
|
||||
Text(
|
||||
'Buttons',
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
const Gap(20),
|
||||
Align(
|
||||
child: Text(
|
||||
'Buttons',
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
),
|
||||
const Gap(20),
|
||||
FlatButton(
|
||||
label: const TextWrapper('Voir notre savoir faire'),
|
||||
normalStyle: const FlatButtonStyle(
|
||||
foregroundColors: MultiColor(_colors),
|
||||
backgroundColors: MultiColor.single(Colors.transparent),
|
||||
borderColors: MultiColor(_colors),
|
||||
stroke: 3,
|
||||
),
|
||||
hoveredStyle: const FlatButtonStyle(
|
||||
foregroundColors: MultiColor.single(Colors.white),
|
||||
backgroundColors: MultiColor(_colors),
|
||||
borderColors: MultiColor(_colors),
|
||||
stroke: 3,
|
||||
),
|
||||
tappedStyle: const FlatButtonStyle(
|
||||
foregroundColors: MultiColor.single(Colors.white),
|
||||
backgroundColors: MultiColor(_colorsDarken),
|
||||
borderColors: MultiColor(_colorsDarken),
|
||||
stroke: 3,
|
||||
),
|
||||
prefix: const Icon(
|
||||
Icons.arrow_forward_rounded,
|
||||
),
|
||||
suffix: const Icon(
|
||||
Icons.arrow_forward_rounded,
|
||||
Center(
|
||||
child: FlatButton(
|
||||
label: const TextWrapper('Voir notre savoir faire'),
|
||||
normalStyle: const FlatButtonStyle(
|
||||
foregroundColors: MultiColor(_colors),
|
||||
backgroundColors: MultiColor.single(Colors.transparent),
|
||||
borderColors: MultiColor(_colors),
|
||||
stroke: 3,
|
||||
),
|
||||
hoveredStyle: const FlatButtonStyle(
|
||||
foregroundColors: MultiColor.single(Colors.white),
|
||||
backgroundColors: MultiColor(_colors),
|
||||
borderColors: MultiColor(_colors),
|
||||
stroke: 3,
|
||||
),
|
||||
tappedStyle: const FlatButtonStyle(
|
||||
foregroundColors: MultiColor.single(Colors.white),
|
||||
backgroundColors: MultiColor(_colorsDarken),
|
||||
borderColors: MultiColor(_colorsDarken),
|
||||
stroke: 3,
|
||||
),
|
||||
prefix: const Icon(
|
||||
Icons.arrow_forward_rounded,
|
||||
),
|
||||
suffix: const Icon(
|
||||
Icons.arrow_forward_rounded,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Gap(20),
|
||||
|
||||
@@ -9,11 +9,14 @@ class Cards extends StatelessWidget {
|
||||
const Cards({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
Widget build(BuildContext context) => ListView(
|
||||
children: [
|
||||
Text(
|
||||
'Cards',
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
const Gap(20),
|
||||
Align(
|
||||
child: Text(
|
||||
'Cards',
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
),
|
||||
const Gap(20),
|
||||
const InformationCards(),
|
||||
|
||||
@@ -1,20 +1,61 @@
|
||||
import 'package:adaptive_theme/adaptive_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_kit_example/buttons/buttons.dart';
|
||||
import 'package:wyatt_ui_kit_example/cards/cards.dart';
|
||||
|
||||
const String title = 'Wyatt Ui Kit Example';
|
||||
const String title = 'Wyatt UIKit Example';
|
||||
|
||||
class Home extends StatefulWidget {
|
||||
const Home({super.key});
|
||||
const Home({super.key, this.forceIndex = 0});
|
||||
|
||||
final int forceIndex;
|
||||
|
||||
@override
|
||||
State<Home> createState() => _HomeState();
|
||||
}
|
||||
|
||||
class _HomeState extends State<Home> {
|
||||
final List<Widget> pages = const [Cards(), Buttons()];
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
currentIndex = widget.forceIndex;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
drawer: const Drawer(),
|
||||
drawer: Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
ListTile(
|
||||
title: const Text('Cards'),
|
||||
onTap: () {
|
||||
if (currentIndex != 0) {
|
||||
setState(() {
|
||||
currentIndex = 0;
|
||||
});
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Buttons'),
|
||||
onTap: () {
|
||||
if (currentIndex != 1) {
|
||||
setState(() {
|
||||
currentIndex = 1;
|
||||
});
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
appBar: AppBar(
|
||||
title: const Text(title),
|
||||
actions: [
|
||||
@@ -30,10 +71,7 @@ class _HomeState extends State<Home> {
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: const [Cards()],
|
||||
),
|
||||
child: pages[currentIndex],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,13 +22,16 @@ import 'package:wyatt_ui_kit_example/home.dart';
|
||||
import 'package:wyatt_ui_kit_example/theme_extension.dart';
|
||||
|
||||
void main(List<String> args) {
|
||||
runApp(const App());
|
||||
const forcePage = int.fromEnvironment('PAGE');
|
||||
runApp(const App(
|
||||
defaultPage: forcePage,
|
||||
),);
|
||||
}
|
||||
|
||||
class App extends StatelessWidget {
|
||||
const App({super.key});
|
||||
const App({required this.defaultPage, super.key});
|
||||
|
||||
static const String title = 'Wyatt Ui Kit Example';
|
||||
final int defaultPage;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => AdaptiveTheme(
|
||||
@@ -125,7 +128,9 @@ class App extends StatelessWidget {
|
||||
Locale('fr', ''),
|
||||
],
|
||||
title: title,
|
||||
home: const Home(),
|
||||
home: Home(
|
||||
forceIndex: defaultPage,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user