This repository was archived by the owner on Mar 26, 2024. It is now read-only.
generated from yumemi-inc/flutter-training-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Merged
Session/3 #16
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4caa354
Add LaunchView with Green Background Color
morikann 3428a64
Fix LaunchScreen to LaunchView
morikann bf0c7f9
Implement Screen Transition from LaunchView to WeatherView
morikann 1d5ff40
Add go_router package
morikann 5145d2a
Modified to Navigation with go_router
morikann d8f8bc3
Fix Transition Using Recursion
morikann 2c9ea64
Define Path as Constant
morikann d60559f
Add Mounted Check in _toWeatherView
morikann 52a28b0
Pop WeatherPage when Close Button Tapped
morikann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,18 +1,18 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_training/view/weather_view/weather_page.dart'; | ||
| import 'package:flutter_training/routes.dart'; | ||
|
|
||
| class App extends StatelessWidget { | ||
| const App({super.key}); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return MaterialApp( | ||
| return MaterialApp.router( | ||
| routerConfig: router, | ||
| debugShowCheckedModeBanner: false, | ||
| title: 'Weather App', | ||
| theme: ThemeData( | ||
| primarySwatch: Colors.blue, | ||
| ), | ||
| home: const WeatherPage(), | ||
| ); | ||
| } | ||
| } |
This file contains hidden or 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,16 @@ | ||
| import 'package:flutter_training/view/launch_view.dart'; | ||
| import 'package:flutter_training/view/weather_view/weather_page.dart'; | ||
| import 'package:go_router/go_router.dart'; | ||
|
|
||
| final router = GoRouter( | ||
| routes: [ | ||
| GoRoute( | ||
| path: LaunchView.path, | ||
| builder: (context, state) => const LaunchView(), | ||
| ), | ||
| GoRoute( | ||
| path: WeatherPage.path, | ||
| builder: (context, state) => const WeatherPage(), | ||
| ) | ||
| ], | ||
| ); | ||
This file contains hidden or 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 'dart:async'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_training/view/weather_view/weather_page.dart'; | ||
| import 'package:go_router/go_router.dart'; | ||
|
|
||
| class LaunchView extends StatefulWidget { | ||
| const LaunchView({super.key}); | ||
|
|
||
| static const path = '/'; | ||
|
|
||
| @override | ||
| State<LaunchView> createState() => _LaunchViewState(); | ||
| } | ||
|
|
||
| class _LaunchViewState extends State<LaunchView> { | ||
| Future<void> _toWeatherView() async { | ||
| await Future<void>.delayed(const Duration(milliseconds: 500)); | ||
| if (!mounted) { | ||
| return; | ||
| } | ||
| await context.push(WeatherPage.path); | ||
| await _toWeatherView(); | ||
| } | ||
|
|
||
| @override | ||
| void initState() { | ||
| super.initState(); | ||
|
|
||
| WidgetsBinding.instance.endOfFrame.then((_) { | ||
| _toWeatherView(); | ||
| }); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return Container(color: Colors.green); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ dependencies: | |
| flutter: | ||
| sdk: flutter | ||
| flutter_svg: ^2.0.4 | ||
| go_router: ^6.5.0 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [感想] |
||
| yumemi_weather: | ||
| git: | ||
| url: https://github.com/yumemi-inc/flutter-training-template.git | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
遷移先が増えていくにつれて見通しが悪くなるのでroutesの定義はroutesファイルに切り出しました。🙋♂️