mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-19 13:13:44 +02:00
feat: add device preview package to the example app
With Device Preview it is easy to view the userstory on different kinds of devices and change settings like language
This commit is contained in:
parent
c15965c982
commit
fa1d9504f5
3 changed files with 21 additions and 2 deletions
|
@ -1,8 +1,19 @@
|
||||||
|
import "package:device_preview/device_preview.dart";
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:flutter_availability/flutter_availability.dart";
|
import "package:flutter_availability/flutter_availability.dart";
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const App());
|
runApp(
|
||||||
|
DevicePreview(
|
||||||
|
enabled: true,
|
||||||
|
isToolbarVisible: true,
|
||||||
|
availableLocales: const [
|
||||||
|
Locale("en_US"),
|
||||||
|
Locale("nl_NL"),
|
||||||
|
],
|
||||||
|
builder: (_) => const App(),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class App extends StatelessWidget {
|
class App extends StatelessWidget {
|
||||||
|
@ -10,6 +21,14 @@ class App extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => MaterialApp(
|
Widget build(BuildContext context) => MaterialApp(
|
||||||
|
builder: DevicePreview.appBuilder,
|
||||||
|
locale: DevicePreview.locale(context),
|
||||||
|
supportedLocales: const [
|
||||||
|
Locale("en", "US"),
|
||||||
|
Locale("nl", "NL"),
|
||||||
|
],
|
||||||
|
theme: ThemeData.light(),
|
||||||
|
darkTheme: ThemeData.dark(),
|
||||||
home: AvailabilityUserStory(
|
home: AvailabilityUserStory(
|
||||||
userId: "",
|
userId: "",
|
||||||
options: AvailabilityOptions(),
|
options: AvailabilityOptions(),
|
||||||
|
|
|
@ -9,6 +9,7 @@ environment:
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
device_preview: ^1.2.0
|
||||||
flutter_availability:
|
flutter_availability:
|
||||||
path: ../../packages/flutter_availability
|
path: ../../packages/flutter_availability
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ class AvailabilityOverview extends StatelessWidget {
|
||||||
/// Callback for when the user wants to navigate to the overview of templates
|
/// Callback for when the user wants to navigate to the overview of templates
|
||||||
final VoidCallback onViewTemplates;
|
final VoidCallback onViewTemplates;
|
||||||
|
|
||||||
|
|
||||||
/// Callback invoked when a user attempts to go back
|
/// Callback invoked when a user attempts to go back
|
||||||
final VoidCallback onBack;
|
final VoidCallback onBack;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue