level2_view.dart 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import 'package:flutter/material.dart';
  2. import 'title_point.dart';
  3. class Level2View extends StatelessWidget {
  4. const Level2View(
  5. {super.key,
  6. required this.level1,
  7. required this.level2,
  8. required this.level1Title,
  9. required this.level2Title,
  10. required this.level2SubTitle,
  11. this.level1Action});
  12. final Widget level1;
  13. final Widget level2;
  14. final Widget? level1Action;
  15. final String level1Title;
  16. final String level2Title;
  17. final Widget level2SubTitle;
  18. @override
  19. Widget build(BuildContext context) {
  20. return Container(
  21. width: double.infinity,
  22. height: double.infinity,
  23. margin: const EdgeInsets.all(20),
  24. padding: const EdgeInsets.fromLTRB(12, 17, 12, 17),
  25. decoration: BoxDecoration(
  26. color: Colors.white, borderRadius: BorderRadius.circular(16)),
  27. child: Row(
  28. children: [
  29. SizedBox(width: 260, height: double.infinity, child: left(context)),
  30. const VerticalDivider(
  31. width: 15, color: Color(0xffd8d8d8), thickness: 1),
  32. Expanded(child: right(context))
  33. ],
  34. ),
  35. );
  36. }
  37. TextStyle get titleStyle => const TextStyle(
  38. fontSize: 14.22, color: Color(0xff333333), fontWeight: FontWeight.w700);
  39. Widget left(BuildContext context) {
  40. return Column(
  41. children: [
  42. Row(
  43. children: [
  44. const Padding(padding: EdgeInsets.all(8), child: TitlePoint()),
  45. Text(level1Title, style: titleStyle),
  46. const Spacer(),
  47. level1Action ?? const SizedBox()
  48. ],
  49. ),
  50. const SizedBox(height: 20),
  51. Expanded(child: level1),
  52. ],
  53. );
  54. }
  55. Widget right(BuildContext context) {
  56. return Column(
  57. children: [
  58. Row(
  59. children: [
  60. const Padding(padding: EdgeInsets.all(8), child: TitlePoint()),
  61. Text(level2Title, style: titleStyle),
  62. Expanded(child: level2SubTitle),
  63. ],
  64. ),
  65. Expanded(
  66. child: Padding(padding: const EdgeInsets.all(18), child: level2))
  67. ],
  68. );
  69. }
  70. }