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.
 
 
 
 
 
 

63 rindas
1.9 KiB

  1. // ignore_for_file: public_member_api_docs, sort_constructors_first
  2. import 'package:flutter/material.dart';
  3. import 'package:provider/provider.dart';
  4. import 'package:qadirneyriz/config/config.dart';
  5. import 'package:qadirneyriz/global/global_state/global_state.dart';
  6. import 'package:qadirneyriz/utils/enums/status.dart';
  7. import 'package:qadirneyriz/widgets/custom_netimage.dart';
  8. class CustomAppbar extends StatefulWidget {
  9. final String? title;
  10. const CustomAppbar({
  11. Key? key,
  12. this.title,
  13. }) : super(key: key);
  14. @override
  15. State<CustomAppbar> createState() => _CustomAppbarState();
  16. }
  17. class _CustomAppbarState extends State<CustomAppbar> {
  18. @override
  19. Widget build(BuildContext context) {
  20. return Consumer<GlobalState>(
  21. builder: (context, globalState, child) {
  22. final String image = globalState.logoImagesStatus == Status.ready
  23. ? globalState.logoImagesModel!.data!
  24. .firstWhere(
  25. (element) => element.key == 'logo',
  26. )
  27. .value ??
  28. ''
  29. : '';
  30. final String ImageUrl = '${config.network.imageUrl}${image}';
  31. return SliverAppBar(
  32. title: Row(
  33. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  34. children: [
  35. const SizedBox(),
  36. Text(
  37. this.widget.title == null ? '' : this.widget.title ?? '',
  38. style: const TextStyle(
  39. fontSize: 12,
  40. color: Colors.black,
  41. ),
  42. ),
  43. globalState.logoImagesStatus == Status.ready
  44. ? CustomImage(
  45. logo: true,
  46. image: ImageUrl,
  47. width: 50,
  48. height: 50,
  49. )
  50. : Container()
  51. ],
  52. ),
  53. backgroundColor: config.ui.backGroundColor,
  54. );
  55. },
  56. );
  57. }
  58. }