|
|
@@ -1,5 +1,8 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import '../widgets/HomeDrawer.dart';
|
|
|
+import '../styles/colors.dart';
|
|
|
+import '../pages/setting.dart';
|
|
|
+
|
|
|
class HomePage extends StatefulWidget {
|
|
|
@override
|
|
|
_HomePageState createState() => _HomePageState();
|
|
|
@@ -8,8 +11,226 @@ class HomePage extends StatefulWidget {
|
|
|
class _HomePageState extends State<HomePage> {
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- return new Scaffold(
|
|
|
- drawer: new HomeDrawer(),
|
|
|
+ return Scaffold(
|
|
|
+ drawer: HomeDrawer(),
|
|
|
+ body: Container(
|
|
|
+ width: double.infinity,
|
|
|
+ height: double.infinity,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(colors: [
|
|
|
+ Color.fromARGB(255, 177, 59, 56),
|
|
|
+ Color.fromARGB(255, 147, 64, 61)
|
|
|
+ ], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
|
|
|
+ child: SafeArea(
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Expanded(
|
|
|
+ child: Stack(
|
|
|
+ children: <Widget>[
|
|
|
+ Positioned(
|
|
|
+ left: 0,
|
|
|
+ top: 0,
|
|
|
+ width: 48,
|
|
|
+ height: 48,
|
|
|
+ child: Material(
|
|
|
+ color: Colors.transparent,
|
|
|
+ child: Builder(
|
|
|
+ builder: (context) => InkWell(
|
|
|
+ onTap: () {
|
|
|
+ Scaffold.of(context).openDrawer();
|
|
|
+ },
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.all(12),
|
|
|
+ child:
|
|
|
+ Image.asset("images/home_icon_wode.png"),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Positioned(
|
|
|
+ right: 0,
|
|
|
+ top: 0,
|
|
|
+ width: 48,
|
|
|
+ height: 48,
|
|
|
+ child: Material(
|
|
|
+ color: Colors.transparent,
|
|
|
+ child: InkWell(
|
|
|
+ onTap: () {
|
|
|
+ Navigator.push(
|
|
|
+ context,
|
|
|
+ new MaterialPageRoute(
|
|
|
+ builder: (context) => new Setting()));
|
|
|
+ },
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.all(12),
|
|
|
+ child: Image.asset("images/home_icon_shezhi.png"),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Center(
|
|
|
+ child: SizedBox(
|
|
|
+ width: 214,
|
|
|
+ height: 214,
|
|
|
+ child: Stack(
|
|
|
+ children: <Widget>[
|
|
|
+ Image.asset("images/home_icon_yuan.png"),
|
|
|
+ Center(
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.baseline,
|
|
|
+ textBaseline: TextBaseline.alphabetic,
|
|
|
+ children: <Widget>[
|
|
|
+ Text(
|
|
|
+ "568",
|
|
|
+ style: TextStyle(
|
|
|
+ color: WHITE_COLOR,
|
|
|
+ fontSize: 68,
|
|
|
+ fontFamily: 'DINEngschrift',
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ "K",
|
|
|
+ style: TextStyle(
|
|
|
+ color: WHITE_COLOR,
|
|
|
+ fontSize: 36,
|
|
|
+ fontFamily: 'DINEngschrift',
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Positioned(
|
|
|
+ bottom: 30,
|
|
|
+ left: 0,
|
|
|
+ right: 0,
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ Text(
|
|
|
+ "当前排名",
|
|
|
+ style: TextStyle(
|
|
|
+ color: WHITE_COLOR, fontSize: 13),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ "98686",
|
|
|
+ style: TextStyle(
|
|
|
+ color: WHITE_COLOR, fontSize: 13),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Positioned(
|
|
|
+ bottom: 11,
|
|
|
+ left: 0,
|
|
|
+ right: 0,
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ Text(
|
|
|
+ "赛季奖金",
|
|
|
+ style: TextStyle(color: WHITE_COLOR, fontSize: 14),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ "刺激战场之大逃杀",
|
|
|
+ style: TextStyle(color: WHITE_COLOR, fontSize: 14),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ child: GridView.count(
|
|
|
+ shrinkWrap: true,
|
|
|
+ crossAxisCount: 2,
|
|
|
+ children: <Widget>[
|
|
|
+ HomeMenu(
|
|
|
+ "images/home_icon_fangjian.png",
|
|
|
+ "创建房间",
|
|
|
+ onTapHomeMenu: () {},
|
|
|
+ ),
|
|
|
+ HomeMenu(
|
|
|
+ "images/home_icon_kuaisu.png",
|
|
|
+ "快速进入",
|
|
|
+ onTapHomeMenu: () {},
|
|
|
+ ),
|
|
|
+ HomeMenu(
|
|
|
+ "images/home_icon_sousuo.png",
|
|
|
+ "搜索",
|
|
|
+ onTapHomeMenu: () {},
|
|
|
+ ),
|
|
|
+ HomeMenu(
|
|
|
+ "images/home_icon_youjian.png",
|
|
|
+ "邮件",
|
|
|
+ onTapHomeMenu: () {},
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+typedef int OnTapHomeMenu();
|
|
|
+
|
|
|
+class HomeMenu extends StatelessWidget {
|
|
|
+ final String icon;
|
|
|
+ final String title;
|
|
|
+ final OnTapHomeMenu onTapHomeMenu;
|
|
|
+ HomeMenu(this.icon, this.title, {this.onTapHomeMenu});
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ return Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(
|
|
|
+ begin: Alignment.topCenter,
|
|
|
+ end: Alignment.bottomCenter,
|
|
|
+ colors: [Color(0xFF626C85), Color(0xFF3D3E6C)])),
|
|
|
+ child: AspectRatio(
|
|
|
+ aspectRatio: 1,
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ border: Border(
|
|
|
+ left: BorderSide(width: 0.5, color: Color(0x80000000)),
|
|
|
+ right: BorderSide(width: 0.5, color: Color(0x80000000)),
|
|
|
+ bottom: BorderSide(width: 1, color: Color(0x80000000)))),
|
|
|
+ child: Material(
|
|
|
+ color: Colors.transparent,
|
|
|
+ child: InkWell(
|
|
|
+ onTap: onTapHomeMenu,
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: <Widget>[
|
|
|
+ SizedBox(
|
|
|
+ width: 44,
|
|
|
+ height: 34,
|
|
|
+ child: FittedBox(
|
|
|
+ fit: BoxFit.contain,
|
|
|
+ child: Image.asset(icon),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ title,
|
|
|
+ style: TextStyle(color: WHITE_COLOR, fontSize: 14),
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
}
|