Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session/3 #16

Merged
merged 9 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_training/view/weather_view/weather_page.dart';
import 'package:flutter_training/view/launch_page.dart';

void main() {
runApp(const MainApp());
Expand All @@ -11,7 +11,7 @@ class MainApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: WeatherPage(),
home: LaunchPage(),
mqkotoo marked this conversation as resolved.
Show resolved Hide resolved
);
}
}
37 changes: 37 additions & 0 deletions lib/view/launch_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
import 'package:flutter_training/view/weather_view/weather_page.dart';

class LaunchPage extends StatefulWidget {
const LaunchPage({super.key});

@override
State<LaunchPage> createState() => _LaunchPageState();
}

class _LaunchPageState extends State<LaunchPage> {
Future<void> _toWeatherPage() async {
await Future<void>.delayed(const Duration(milliseconds: 500));
if (!mounted) {
mqkotoo marked this conversation as resolved.
Show resolved Hide resolved
return;
}
await Navigator.push(
context,
MaterialPageRoute<void>(
builder: (context) => const WeatherPage(),
),
);
// WeatherPageから帰ってくるのを待つ
await _toWeatherPage();
}

@override
void initState() {
super.initState();
WidgetsBinding.instance.endOfFrame.then((_) => _toWeatherPage());
Yamasaki-pan961 marked this conversation as resolved.
Show resolved Hide resolved
}

@override
Widget build(BuildContext context) {
return Container(color: Colors.green);
mqkotoo marked this conversation as resolved.
Show resolved Hide resolved
}
}
1 change: 0 additions & 1 deletion lib/view/weather_view/component/weather_forecast.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_training/model/weather_condition.dart';


class WeatherForecast extends StatelessWidget {
const WeatherForecast({super.key, required this.weatherCondition});

Expand Down
2 changes: 1 addition & 1 deletion lib/view/weather_view/weather_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class _WeatherPageState extends State<WeatherPage> {
Expanded(
child: TextButton(
child: const Text('Close'),
onPressed: () {},
onPressed: () => Navigator.pop(context),
),
),
Expanded(
Expand Down
Loading