generated from Stacked-Org/package-template
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Unknown view to Web template (#8)
* Add UI constants * Add UnknownView * Redirect to UnknownView when route was not find * Compile templates
- Loading branch information
1 parent
c84deca
commit d54c8e9
Showing
11 changed files
with
640 additions
and
107 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
21 changes: 21 additions & 0 deletions
21
lib/src/templates/app/web/lib/ui/common/app_styles.dart.stk
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,21 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
TextStyle get ktsHeading1 => const TextStyle( | ||
fontSize: 80, | ||
height: 0.95, | ||
fontWeight: FontWeight.w800, | ||
); | ||
|
||
TextStyle get ktsHeading2 => const TextStyle( | ||
fontSize: 40, | ||
height: 0.95, | ||
fontWeight: FontWeight.w800, | ||
); | ||
|
||
TextStyle get ktsBodyRegular => const TextStyle( | ||
fontSize: 15, | ||
); | ||
|
||
TextStyle get ktsBodyLarge => const TextStyle( | ||
fontSize: 20, | ||
); |
31 changes: 31 additions & 0 deletions
31
lib/src/templates/app/web/lib/ui/views/unknown/unknown_view.dart.stk
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,31 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:responsive_builder/responsive_builder.dart'; | ||
import 'package:stacked/stacked.dart'; | ||
|
||
import 'unknown_view.desktop.dart'; | ||
import 'unknown_view.tablet.dart'; | ||
import 'unknown_view.mobile.dart'; | ||
import 'unknown_viewmodel.dart'; | ||
|
||
class UnknownView extends StackedView<UnknownViewModel> { | ||
const UnknownView({super.key}); | ||
|
||
@override | ||
Widget builder( | ||
BuildContext context, | ||
UnknownViewModel viewModel, | ||
Widget? child, | ||
) { | ||
return ScreenTypeLayout.builder( | ||
mobile: (_) => const UnknownViewMobile(), | ||
tablet: (_) => const UnknownViewTablet(), | ||
desktop: (_) => const UnknownViewDesktop(), | ||
); | ||
} | ||
|
||
@override | ||
UnknownViewModel viewModelBuilder( | ||
BuildContext context, | ||
) => | ||
UnknownViewModel(); | ||
} |
38 changes: 38 additions & 0 deletions
38
lib/src/templates/app/web/lib/ui/views/unknown/unknown_view.desktop.dart.stk
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,38 @@ | ||
import 'package:{{packageName}}/ui/common/app_colors.dart'; | ||
import 'package:{{packageName}}/ui/common/app_styles.dart'; | ||
import 'package:{{packageName}}/ui/common/ui_helpers.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:stacked/stacked.dart'; | ||
|
||
import 'unknown_viewmodel.dart'; | ||
|
||
class UnknownViewDesktop extends ViewModelWidget<UnknownViewModel> { | ||
const UnknownViewDesktop({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, UnknownViewModel viewModel) { | ||
return Scaffold( | ||
backgroundColor: kcBackgroundColor, | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Text( | ||
'404', | ||
style: ktsHeading1.copyWith(color: kcWhite, letterSpacing: 20.0), | ||
), | ||
verticalSpaceSmall, | ||
Text( | ||
'PAGE NOT FOUND', | ||
style: ktsBodyLarge.copyWith( | ||
color: kcWhite, | ||
letterSpacing: 20.0, | ||
wordSpacing: 10.0, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
lib/src/templates/app/web/lib/ui/views/unknown/unknown_view.mobile.dart.stk
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,38 @@ | ||
import 'package:{{packageName}}/ui/common/app_colors.dart'; | ||
import 'package:{{packageName}}/ui/common/app_styles.dart'; | ||
import 'package:{{packageName}}/ui/common/ui_helpers.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:stacked/stacked.dart'; | ||
|
||
import 'unknown_viewmodel.dart'; | ||
|
||
class UnknownViewMobile extends ViewModelWidget<UnknownViewModel> { | ||
const UnknownViewMobile({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, UnknownViewModel viewModel) { | ||
return Scaffold( | ||
backgroundColor: kcBackgroundColor, | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Text( | ||
'404', | ||
style: ktsHeading1.copyWith(color: kcWhite, letterSpacing: 20.0), | ||
), | ||
verticalSpaceSmall, | ||
Text( | ||
'PAGE NOT FOUND', | ||
style: ktsBodyLarge.copyWith( | ||
color: kcWhite, | ||
letterSpacing: 20.0, | ||
wordSpacing: 10.0, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
lib/src/templates/app/web/lib/ui/views/unknown/unknown_view.tablet.dart.stk
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,38 @@ | ||
import 'package:{{packageName}}/ui/common/app_colors.dart'; | ||
import 'package:{{packageName}}/ui/common/app_styles.dart'; | ||
import 'package:{{packageName}}/ui/common/ui_helpers.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:stacked/stacked.dart'; | ||
|
||
import 'unknown_viewmodel.dart'; | ||
|
||
class UnknownViewTablet extends ViewModelWidget<UnknownViewModel> { | ||
const UnknownViewTablet({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, UnknownViewModel viewModel) { | ||
return Scaffold( | ||
backgroundColor: kcBackgroundColor, | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Text( | ||
'404', | ||
style: ktsHeading1.copyWith(color: kcWhite, letterSpacing: 20.0), | ||
), | ||
verticalSpaceSmall, | ||
Text( | ||
'PAGE NOT FOUND', | ||
style: ktsBodyLarge.copyWith( | ||
color: kcWhite, | ||
letterSpacing: 20.0, | ||
wordSpacing: 10.0, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
lib/src/templates/app/web/lib/ui/views/unknown/unknown_viewmodel.dart.stk
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,3 @@ | ||
import 'package:stacked/stacked.dart'; | ||
|
||
class UnknownViewModel extends BaseViewModel {} |
11 changes: 11 additions & 0 deletions
11
lib/src/templates/app/web/test/viewmodels/unknown_viewmodel_test.dart.stk
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,11 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:{{packageName}}/{{{relativeLocatorFilePath}}}'; | ||
|
||
import '../helpers/test_helpers.dart'; | ||
|
||
void main() { | ||
group('UnknownViewModel Tests -', () { | ||
setUp(() => registerServices()); | ||
tearDown(() => locator.reset()); | ||
}); | ||
} |
Oops, something went wrong.