test/lib/home.dart

261 lines
9.3 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class Home extends StatefulWidget {
const Home({super.key});
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
void _gotonewsPage() {
Navigator.pushNamed(context, "/news");
}
void _gotoaboutPage() {
Navigator.pushNamed(context, "/about");
}
void _gotointroducePage() {
Navigator.pushNamed(context, "/introduce");
}
@override
Widget build(BuildContext context) {
return Stack(
children: [
Positioned.fill(
child: Image.asset("assets/background.png", fit: BoxFit.cover),
),
Scaffold(
backgroundColor: Colors.transparent,
drawer: Drawer(
child: Column(
children: [
SizedBox(height: 50,),
Image.asset("assets/Logo.png", height: 80),
SizedBox(height: 50),
OutlinedButton(
style: OutlinedButton.styleFrom(
side: BorderSide(
color: Colors.transparent
)
),
onPressed: () {_gotonewsPage();},
child: SizedBox(
width: 200,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Image.asset("assets/latest_news6.png", height: 30),
SizedBox(width: 30, height: 50),
Text(
"最新",
style: TextStyle(
color: Color(0xff6B6B6B),
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
Text(
"消息",
style: TextStyle(
color: Color(0xffFF7817),
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
SizedBox(height: 30),
OutlinedButton(
style: OutlinedButton.styleFrom(
side: BorderSide(
color: Colors.transparent
)
),
onPressed: () {_gotoaboutPage();},
child: SizedBox(
width: 200,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Image.asset("assets/about6.png", height: 30),
SizedBox(width: 30, height: 50),
Text(
"關於",
style: TextStyle(
color: Color(0xff6B6B6B),
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
Text(
"競賽",
style: TextStyle(
color: Color(0xffFF7817),
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
SizedBox(height: 30),
OutlinedButton(
style: OutlinedButton.styleFrom(
side: BorderSide(
color: Colors.transparent
)
),
onPressed: () {_gotointroducePage();},
child: SizedBox(
width: 200,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Image.asset("assets/introduce6.png", height: 30),
SizedBox(width: 30, height: 50),
Text(
"職類",
style: TextStyle(
color: Color(0xff6B6B6B),
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
Text(
"介紹",
style: TextStyle(
color: Color(0xffFF7817),
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
),
appBar: AppBar(
backgroundColor: Colors.transparent,
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: Image.asset("assets/16.png", fit: BoxFit.contain),
onPressed: () {
Scaffold.of(context).openDrawer();
},
);
},
),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset("assets/Logo.png", height: 130),
SizedBox(height: 80),
OutlinedButton(
style: OutlinedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
onPressed: () {_gotonewsPage();},
child: SizedBox(
width: 250,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Image.asset("assets/latest_news6.png", height: 30),
SizedBox(width: 30, height: 50),
Text(
"最新消息",
style: TextStyle(
color: Color(0xff1D1AC7),
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
SizedBox(height: 30),
OutlinedButton(
style: OutlinedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
onPressed: () {_gotoaboutPage();},
child: SizedBox(
width: 250,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Image.asset("assets/about6.png", height: 30),
SizedBox(width: 30, height: 50),
Text(
"關於競賽",
style: TextStyle(
color: Color(0xff1D1AC7),
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
SizedBox(height: 30),
OutlinedButton(
style: OutlinedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
onPressed: () {_gotointroducePage();},
child: SizedBox(
width: 250,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Image.asset("assets/introduce6.png", height: 30),
SizedBox(width: 30, height: 50),
Text(
"職類介紹",
style: TextStyle(
color: Color(0xff1D1AC7),
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
),
),
],
);
}
}