| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
- import 'OpenRoom.dart'; //创建房间
- class CreateRoom extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- Navigator.of(context).pop();
- },
- child: Scaffold(
- backgroundColor: Color(0xCC000000),
- body: Container(
- child: SizedBox.expand(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- _CreateRoomBtn('创建普通房间',0),
- SizedBox(
- height: 36,
- ),
- _CreateRoomBtn('创建官方房间', 1)
- ],
- ),
- ),
- ),
- ),
- );
- }
- }
- class _CreateRoomBtn extends StatelessWidget {
- final String title;
- final int btnIndex;
- _CreateRoomBtn(this.title, this.btnIndex);
- List<Color> colorList=[Color(0xFFFFB726),Color(0xFFFDC372)];
- List<List<String>> imageList=[[
- 'images/tancuang_shang.png',
- 'images/tancuang_xia.png'
- ],[
- 'images/tancuang_huang_shang.png',
- 'images/tancuang_huang_xia.png'
- ]];
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- Navigator.pushReplacement(
- context,
- CupertinoPageRoute(
- builder: (context) => OpenRoom(
- roomFlag: title == '创建普通房间' ? '0' : '1')));
- },
- child: Container(
- width: 250,
- height: 96,
- decoration: BoxDecoration(
- border: Border.all(width: 1, color: colorList[btnIndex]),
- image: DecorationImage(
- image: AssetImage('images/img_guangmang.png'),
- fit: BoxFit.cover)),
- child: Stack(
- children: <Widget>[
- Center(
- child: Text(
- title,
- style: TextStyle(color: colorList[btnIndex], fontSize: 22),
- ),
- ),
- Positioned(
- top: 0,
- left: 0,
- child: Image.asset(
- imageList[btnIndex][0],
- ),
- ),
- Positioned(
- bottom: 0,
- right: 4,
- child: Image.asset(
- imageList[btnIndex][1],
- ),
- )
- ],
- ),
- ),
- );
- }
- }
|