CreateRoom.dart 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'OpenRoom.dart'; //创建房间
  4. class CreateRoom extends StatelessWidget {
  5. @override
  6. Widget build(BuildContext context) {
  7. return GestureDetector(
  8. onTap: () {
  9. Navigator.of(context).pop();
  10. },
  11. child: Scaffold(
  12. backgroundColor: Color(0xCC000000),
  13. body: Container(
  14. child: SizedBox.expand(
  15. child: Column(
  16. mainAxisAlignment: MainAxisAlignment.center,
  17. children: <Widget>[
  18. _CreateRoomBtn("创建普通房间"),
  19. SizedBox(
  20. height: 36,
  21. ),
  22. _CreateRoomBtn("创建官方房间")
  23. ],
  24. ),
  25. ),
  26. ),
  27. ),
  28. );
  29. }
  30. }
  31. class _CreateRoomBtn extends StatelessWidget {
  32. final String title;
  33. _CreateRoomBtn(this.title);
  34. @override
  35. Widget build(BuildContext context) {
  36. return GestureDetector(
  37. onTap: () {
  38. Navigator.push(context, new CupertinoPageRoute(builder: (context) => new OpenRoom(roomFlag: this.title == '创建普通房间' ? '0' : '1')));
  39. },
  40. child: Container(
  41. width: 250,
  42. height: 96,
  43. decoration: BoxDecoration(
  44. border: Border.all(width: 1, color: Color(0x80000000)),
  45. gradient: LinearGradient(colors: [Color(0xFF626C85), Color(0xFF3D3E6C)], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
  46. child: Center(
  47. child: Text(
  48. title,
  49. style: TextStyle(color: Colors.white, fontSize: 22),
  50. ),
  51. ),
  52. ),
  53. );
  54. }
  55. }