third/testModuleD_1/testmoduleD/lib/gameOver.dart
2025-07-29 14:31:14 +08:00

54 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:testmoduled/ranking.dart';
class GameOver extends StatefulWidget {
const GameOver({super.key});
@override
State<GameOver> createState() => _GameOverState();
}
class _GameOverState extends State<GameOver> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body:Stack(
children: [
Positioned(
left: 0,
right: 0,
top: 32,
child: Text("Game Over")
),
//列表
Positioned(
left: 32,
right: 32,
bottom: 0,
child: myButton(50, double.infinity, "Next ➡️", Colors.black87, () => Navigator.of(context).push(MaterialPageRoute(builder: (c)=>Ranking())))
),
],
)
);
}
}
myButton(double height,double width,String text,Color backColor,Function()? onTap){
return GestureDetector(
onTap: onTap,
child: Container(
alignment: Alignment.center,
height: height,
width: width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1,color: Colors.black54),
color: backColor
),
child: Text(text,style: TextStyle(fontSize: 14,fontWeight: FontWeight.w500,color: Colors.white))
),
);
}