-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from enpitut2023/penalty
罰ゲーム画面の修正
- Loading branch information
Showing
3 changed files
with
35 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,38 +1,47 @@ | ||
import 'dart:math'; | ||
import 'package:flutter/material.dart'; | ||
|
||
|
||
class ResultPage extends StatelessWidget{ | ||
const ResultPage({Key? key}) : super(key: key); | ||
|
||
get math => null; | ||
class ResultPage extends StatelessWidget { | ||
final List<String> strings = [ | ||
"ライン自動送信", | ||
"一発芸", | ||
"10分間服を逆に着る", | ||
"SNSに自撮りを投稿", | ||
]; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final int minIndex = 0; | ||
final int maxIndex = strings.length - 1; | ||
|
||
String _imgURL; | ||
List<String> imgURLs = [ | ||
//ここに表示したい画像URLを追加 | ||
'images/girichocoyade.png', | ||
'images/honnmeiyade.png', | ||
'images/taiyakiyade.png', | ||
'images/tomochocoyade.png', | ||
]; | ||
final ram = Random(DateTime.now().millisecondsSinceEpoch);//乱数の種を時間ごとに変更するためのDataTime | ||
|
||
final random = Random(); | ||
final randomIndex = minIndex + random.nextInt(maxIndex - minIndex + 1); | ||
|
||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('罰ゲーム'), | ||
leading: IconButton( | ||
icon: Icon(Icons.arrow_back, color: Colors.transparent), // デフォルトの戻るボタンを非表示に | ||
onPressed: () {}, | ||
), | ||
actions: [ | ||
// "main.dartに戻る"ボタンを配置 | ||
IconButton( | ||
icon: Icon(Icons.arrow_back), // 戻るアイコン | ||
onPressed: () { | ||
// ボタンが押されたときの処理 | ||
Navigator.of(context).popUntil(ModalRoute.withName('/')); | ||
// ページを戻る | ||
}, | ||
), | ||
], | ||
), | ||
body: Center( | ||
child: | ||
const Text('だよ!', | ||
style: TextStyle( | ||
fontSize: 50 | ||
), | ||
), | ||
child: Text( | ||
'罰ゲームは\n' + strings[randomIndex], | ||
style: TextStyle(fontSize: 24), | ||
), | ||
), | ||
); | ||
} | ||
} | ||
} |