settings_title_bar_widget.dart 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import 'package:flutter/material.dart';
  2. import 'package:intl/intl.dart';
  3. import 'package:photos/models/user_details.dart';
  4. import 'package:photos/states/user_details_state.dart';
  5. import 'package:photos/theme/ente_theme.dart';
  6. import 'package:photos/ui/common/loading_widget.dart';
  7. class SettingsTitleBarWidget extends StatelessWidget {
  8. const SettingsTitleBarWidget({Key? key}) : super(key: key);
  9. @override
  10. Widget build(BuildContext context) {
  11. final inheritedDetails = InheritedUserDetails.of(context);
  12. final userDetails = inheritedDetails?.userDetails;
  13. bool isCached = false;
  14. if (inheritedDetails != null) {
  15. isCached = inheritedDetails.isCached;
  16. }
  17. return Container(
  18. padding: const EdgeInsets.symmetric(vertical: 4),
  19. child: Padding(
  20. padding: const EdgeInsets.fromLTRB(8, 0, 20, 0),
  21. child: Row(
  22. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  23. children: [
  24. IconButton(
  25. visualDensity: const VisualDensity(horizontal: -2, vertical: -2),
  26. onPressed: () {
  27. Navigator.pop(context);
  28. },
  29. icon: const Icon(Icons.keyboard_double_arrow_left_outlined),
  30. ),
  31. userDetails is UserDetails && !isCached
  32. ? Text(
  33. "${NumberFormat().format(userDetails.fileCount)} memories",
  34. style: getEnteTextTheme(context).largeBold,
  35. )
  36. : const EnteLoadingWidget(),
  37. ],
  38. ),
  39. ),
  40. );
  41. }
  42. }