feat: add the flutter_availability userstory to the example app

This commit is contained in:
Freek van de Ven 2024-07-04 09:44:27 +02:00 committed by FlutterJoey
parent d52b18b9bb
commit 1b6a727305
2 changed files with 11 additions and 50 deletions

View file

@ -1,64 +1,24 @@
import "package:flutter/material.dart"; import "package:flutter/material.dart";
import "package:flutter_availability/flutter_availability.dart";
void main() { void main() {
runApp(const MyApp()); runApp(const App());
} }
class MyApp extends StatelessWidget { class App extends StatelessWidget {
const MyApp({super.key}); const App({super.key});
@override @override
Widget build(BuildContext context) => MaterialApp( Widget build(BuildContext context) => const MaterialApp(
title: "Flutter Demo", home: Home(),
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: "Flutter Demo Home Page"),
); );
} }
class MyHomePage extends StatefulWidget { class Home extends StatelessWidget {
const MyHomePage({required this.title, super.key}); const Home({super.key});
final String title;
@override @override
State<MyHomePage> createState() => _MyHomePageState(); Widget build(BuildContext context) => availabilityNavigatorUserStory(
} context,
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
"You have pushed the button this many times:",
),
Text(
"$_counter",
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: "Increment",
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
); );
} }

View file

@ -10,6 +10,7 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
intl: any
flutter_availability_data_interface: flutter_availability_data_interface:
git: git:
url: https://github.com/Iconica-Development/flutter_availability url: https://github.com/Iconica-Development/flutter_availability