page_portrait.dart 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import 'package:flutter/material.dart';
  2. import 'package:tetris/main.dart';
  3. import 'package:tetris/panel/controller.dart';
  4. import 'package:tetris/panel/screen.dart';
  5. part 'page_land.dart';
  6. class PagePortrait extends StatelessWidget {
  7. const PagePortrait({super.key});
  8. @override
  9. Widget build(BuildContext context) {
  10. final size = MediaQuery.of(context).size;
  11. final screenW = size.width * 0.8;
  12. return SizedBox.expand(
  13. child: Container(
  14. color: backgroundColor,
  15. child: Padding(
  16. padding: MediaQuery.of(context).padding,
  17. child: Column(
  18. children: <Widget>[
  19. const Spacer(),
  20. _ScreenDecoration(child: Screen(width: screenW)),
  21. const Spacer(flex: 2),
  22. const GameController(),
  23. ],
  24. ),
  25. ),
  26. ),
  27. );
  28. }
  29. }
  30. class _ScreenDecoration extends StatelessWidget {
  31. final Widget child;
  32. const _ScreenDecoration({
  33. Key? key,
  34. required this.child,
  35. }) : super(key: key);
  36. @override
  37. Widget build(BuildContext context) {
  38. return Container(
  39. decoration: const BoxDecoration(
  40. border: Border(
  41. top: BorderSide(color: Color(0xFF987f0f), width: screenBorderWidth),
  42. left: BorderSide(color: Color(0xFF987f0f), width: screenBorderWidth),
  43. right: BorderSide(color: Color(0xFFfae36c), width: screenBorderWidth),
  44. bottom:
  45. BorderSide(color: Color(0xFFfae36c), width: screenBorderWidth),
  46. ),
  47. ),
  48. child: Container(
  49. decoration: BoxDecoration(border: Border.all(color: Colors.black54)),
  50. child: Container(
  51. padding: const EdgeInsets.all(3),
  52. color: screenBackground,
  53. child: child,
  54. ),
  55. ),
  56. );
  57. }
  58. }