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

64 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:testmoduled/username.dart';
void main(){
runApp(MaterialApp(
home: StartGame(),
debugShowCheckedModeBanner: false,
));
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,overlays: []);
}
late double phoneHeight;
late double phoneWidth;
class StartGame extends StatefulWidget {
const StartGame({super.key});
@override
State<StartGame> createState() => _StartGameState();
}
class _StartGameState extends State<StartGame> {
@override
Widget build(BuildContext context) {
phoneHeight = MediaQuery.of(context).size.height;
phoneWidth = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("French dessert\ncollector",textAlign: TextAlign.center,style: TextStyle(fontSize: 22,fontWeight: FontWeight.w500,color: Colors.black87),),
SizedBox(height: 80),
myButton(40, 220, "Game Start", Colors.white,()=>Navigator.of(context).push(MaterialPageRoute(builder: (c)=>userName())))
],
),
),
);
}
}
myButton(double height,double width,String text,Color backColor,Function()? onTap){
return GestureDetector(
onTap: onTap,
child: Container(
height: height,
width: width,
alignment: Alignment.center,
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.black54))
),
);
}