| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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(0xFFC2524D),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],
- width: 131,
- ),
- ),
- Positioned(
- bottom: 0,
- right: 4,
- child: Image.asset(
- imageList[btnIndex][1],
- width: 148,
- ),
- )
- ],
- ),
- ),
- );
- }
- }
|