基础组件库
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

107 satır
2.8 KiB

  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:tab_indicator_styler/tab_indicator_styler.dart';
  4. import 'package:zhiying_base_widget/pages/wallet_page/wallet_detail_list_page.dart';
  5. import 'package:zhiying_comm/util/extension/color.dart';
  6. class WalletDetailPage extends StatefulWidget {
  7. @override
  8. _WalletDetailPageState createState() => _WalletDetailPageState();
  9. }
  10. class _WalletDetailPageState extends State<WalletDetailPage>
  11. with TickerProviderStateMixin {
  12. TabController _controller;
  13. @override
  14. void initState() {
  15. _controller = TabController(vsync: this, length: 2);
  16. super.initState();
  17. }
  18. @override
  19. Widget build(BuildContext context) {
  20. return Scaffold(
  21. appBar: _createNav(),
  22. body: SafeArea(
  23. child: Column(
  24. children: <Widget>[
  25. _createTab(),
  26. Expanded(
  27. child: _createContent(),
  28. ),
  29. ],
  30. ),
  31. ),
  32. );
  33. }
  34. // 导航栏
  35. Widget _createNav() {
  36. return CupertinoNavigationBar(
  37. border: Border(
  38. bottom: BorderSide(
  39. width: 0.0, // One physical pixel.
  40. style: BorderStyle.none,
  41. ),
  42. ),
  43. backgroundColor: Colors.white,
  44. leading: Navigator.canPop(context)
  45. ? GestureDetector(
  46. child: Container(
  47. padding: EdgeInsets.zero,
  48. child: Icon(
  49. Icons.arrow_back_ios,
  50. size: 20,
  51. ),
  52. ),
  53. onTap: () {
  54. if (Navigator.canPop(context)) {
  55. Navigator.pop(context);
  56. }
  57. },
  58. )
  59. : Container(),
  60. middle: Text(
  61. '明细',
  62. style: TextStyle(
  63. fontSize: 15,
  64. color: Color(0xff333333),
  65. ),
  66. ),
  67. );
  68. }
  69. Widget _createTab() {
  70. return Container(
  71. color: Colors.white,
  72. child: TabBar(
  73. isScrollable: false,
  74. labelStyle: TextStyle(fontWeight: FontWeight.bold, fontSize: 13),
  75. unselectedLabelStyle: TextStyle(fontSize: 13),
  76. indicator: MaterialIndicator(
  77. height: 2,
  78. topLeftRadius: 8,
  79. topRightRadius: 8,
  80. bottomLeftRadius: 8,
  81. bottomRightRadius: 8,
  82. color: HexColor.fromHex('#F94B47'),
  83. horizontalPadding: 30,
  84. ),
  85. controller: _controller,
  86. tabs: List.generate(2, (index) => Tab(text: '收入明细')),
  87. indicatorColor: Colors.red,
  88. unselectedLabelColor: HexColor.fromHex('#999999'),
  89. labelColor: HexColor.fromHex('#000000'),
  90. ),
  91. );
  92. }
  93. Widget _createContent() {
  94. return TabBarView(
  95. controller: _controller,
  96. children: <Widget>[WalletDetailListPage(), Container()],
  97. );
  98. }
  99. }