基础组件库
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

custom_appbar_widget.dart 1.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import 'dart:convert';
  2. import 'package:flutter/material.dart';
  3. import 'package:zhiying_comm/zhiying_comm.dart';
  4. ///
  5. /// 通用模块的AppBar Widget
  6. ///
  7. class CustomAppBarWidget extends StatelessWidget {
  8. final Map<String, dynamic> data;
  9. Map<String, dynamic> model;
  10. CustomAppBarWidget(this.data, {Key key}) : super(key: key) {
  11. try {
  12. var dataItem = data['data'];
  13. if (!EmptyUtil.isEmpty(dataItem)) {
  14. model = dataItem is Map ? dataItem : dataItem is String ? jsonDecode(dataItem) : null;
  15. }
  16. } catch (e, s) {
  17. Logger.error(e, s);
  18. }
  19. }
  20. @override
  21. Widget build(BuildContext context) {
  22. return SliverAppBar(
  23. leading: IconButton(
  24. icon: Icon(
  25. Icons.arrow_back_ios,
  26. size: 22,
  27. color: HexColor.fromHex( '#333333'),
  28. ),
  29. onPressed: () => Navigator.maybePop(context),
  30. ),
  31. title: Text(
  32. '自定义页面',
  33. style: TextStyle(
  34. fontSize: 15,
  35. color: HexColor.fromHex('#333333'),
  36. fontWeight: FontWeight.bold,
  37. ),
  38. ),
  39. );
  40. }
  41. }