• Source
    1. import 'package:flutter/material.dart';
    2.  
    3. class ExpandedPage extends StatefulWidget {
    4. @override
    5. State<StatefulWidget> createState() => ExpandedPageState();
    6. }
    7.  
    8. class ExpandedPageState extends State<ExpandedPage> {
    9. @override
    10. Widget build(BuildContext context) {
    11. return Scaffold(
    12. appBar: new AppBar(title: Text('Expanded')),
    13. body: SafeArea(
    14. child: Container(
    15. padding: EdgeInsets.all(8),
    16. color: Colors.amber,
    17. child: Row(
    18. children: <Widget>[
    19. Expanded(
    20. child: Container(
    21. color: Colors.greenAccent,
    22. child: Align(
    23. heightFactor: 1,
    24. child: Text(
    25. '生活文化',
    26. style: TextStyle(color: Colors.white),
    27. ),
    28. ),
    29. padding: EdgeInsets.all(8),
    30. ),
    31. ),
    32. Expanded(
    33. flex: 2,
    34. child: Container(
    35. color: Colors.redAccent,
    36. child: Align(
    37. heightFactor: 1,
    38. child: Text(
    39. '疫情專區',
    40. style: TextStyle(color: Colors.white),
    41. ),
    42. ),
    43. padding: EdgeInsets.all(8),
    44. ),
    45. ),
    46. Expanded(
    47. child: Container(
    48. color: Colors.blueAccent,
    49. child: Align(
    50. heightFactor: 1,
    51. child: Text(
    52. '國際政治',
    53. style: TextStyle(color: Colors.white),
    54. ),
    55. ),
    56. padding: EdgeInsets.all(8),
    57. ),
    58. ),
    59. ],
    60. ),
    61. )),
    62. );
    63. }
    64. }
    65.