-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: moving packages into the system folder
feat: added sample features for counter, settings and the launchpad
- Loading branch information
1 parent
d33228b
commit e1b3a74
Showing
94 changed files
with
175 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_mobx/flutter_mobx.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
import 'package:mobx/mobx.dart'; | ||
import 'package:vyuh_core/vyuh_core.dart'; | ||
|
||
final featureCounter = FeatureDescriptor( | ||
name: 'counter', | ||
title: 'The classic Flutter counter', | ||
description: 'A simple counter that tracks the number of button presses', | ||
routes: () async { | ||
return [ | ||
GoRoute( | ||
path: '/counter', | ||
builder: (context, state) { | ||
return const _Counter(); | ||
}), | ||
]; | ||
}, | ||
); | ||
|
||
class _Counter extends StatefulWidget { | ||
const _Counter(); | ||
|
||
@override | ||
State<_Counter> createState() => _CounterState(); | ||
} | ||
|
||
class _CounterState extends State<_Counter> { | ||
final counter = 0.obs(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(title: const Text('Counter')), | ||
body: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
const Text( | ||
'Number of Button presses', | ||
textAlign: TextAlign.center, | ||
), | ||
Observer( | ||
builder: (_) => Text( | ||
'${counter.value}', | ||
style: Theme.of(context) | ||
.textTheme | ||
.displayLarge | ||
?.apply(fontFamily: 'Courier New', fontWeightDelta: 2), | ||
textAlign: TextAlign.center, | ||
)), | ||
], | ||
), | ||
floatingActionButton: IconButton.filled( | ||
icon: const Icon(Icons.add), | ||
onPressed: () => runInAction(() => counter.value++), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
library feature_sample; | ||
|
||
export './feature.dart'; | ||
export './feature_counter.dart'; | ||
export './feature_launcher.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_mobx/flutter_mobx.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
import 'package:mobx/mobx.dart'; | ||
import 'package:vyuh_core/vyuh_core.dart'; | ||
|
||
final featureCounter = FeatureDescriptor( | ||
name: 'settings', | ||
title: 'Settings', | ||
description: 'Settings to adjust the light/dark mode and other features', | ||
routes: () async { | ||
return [ | ||
GoRoute( | ||
path: '/settings', | ||
builder: (context, state) { | ||
return const _Settings(); | ||
}), | ||
]; | ||
}, | ||
); | ||
|
||
class _Settings extends StatefulWidget { | ||
const _Settings(); | ||
|
||
@override | ||
State<_Settings> createState() => _SettingsState(); | ||
} | ||
|
||
class _SettingsState extends State<_Settings> { | ||
@override | ||
Widget build(BuildContext context) { | ||
final service = vyuh.di.get<ThemeService>(); | ||
|
||
return Scaffold( | ||
appBar: AppBar(title: const Text('Settings')), | ||
body: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
const Text( | ||
'Theme', | ||
textAlign: TextAlign.center, | ||
), | ||
Observer( | ||
builder: (_) => Switch( | ||
value: service.currentMode.value == ThemeMode.light, | ||
onChanged: (value) { | ||
runInAction(() => service.currentMode.value = | ||
value ? ThemeMode.light : ThemeMode.dark); | ||
}, | ||
)), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.