CreateRoom.dart 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. print(this.title);
  39. Navigator.push(
  40. context,
  41. new CupertinoPageRoute(
  42. builder: (context) => new OpenRoom(
  43. roomFlag: this.title == '创建普通房间' ? '0' : '1')));
  44. },
  45. child: Container(
  46. width: 250,
  47. height: 96,
  48. decoration: BoxDecoration(
  49. border: Border.all(width: 1, color: Color(0x80000000)),
  50. gradient: LinearGradient(
  51. colors: [Color(0xFF626C85), Color(0xFF3D3E6C)],
  52. begin: Alignment.topCenter,
  53. end: Alignment.bottomCenter)),
  54. child: Center(
  55. child: Text(
  56. title,
  57. style: TextStyle(color: Colors.white, fontSize: 22),
  58. ),
  59. ),
  60. ),
  61. );
  62. }
  63. }