Skip to content

Commit

Permalink
Merge pull request #4 from enpitut2023/penalty
Browse files Browse the repository at this point in the history
罰ゲーム画面の修正
  • Loading branch information
kou7306 authored Nov 8, 2023
2 parents 3636f79 + 2605845 commit ded93c3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 49 deletions.
24 changes: 0 additions & 24 deletions lib/judge.dart

This file was deleted.

7 changes: 4 additions & 3 deletions lib/penalty.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class _RoulettePageState extends State<RoulettePage> with SingleTickerProviderSt
textBuilder: (index) => values[index],
textStyleBuilder: (index) {
// Customize text style, don't forget to return it
// テキストスタイルをカスタマイズする
return TextStyle(fontSize: 20, color: Colors.white); // 20はフォントサイズ
},
);
//ルーレットコントローラ
Expand Down Expand Up @@ -74,11 +76,10 @@ class _RoulettePageState extends State<RoulettePage> with SingleTickerProviderSt
//結果(チョコ)画面へ遷移
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const ResultPage(),
MaterialPageRoute(builder: (context) => ResultPage(),
));
} ,
child: const Text("受け取ってね!",
),
child: const Text('スタート'),
),
],
),
Expand Down
53 changes: 31 additions & 22 deletions lib/result_page.dart
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),
),
),
);
}
}
}

0 comments on commit ded93c3

Please sign in to comment.