home_top_bar.dart 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import 'package:app_flowy/workspace/domain/image.dart';
  2. import 'package:app_flowy/workspace/presentation/home/home_sizes.dart';
  3. import 'package:app_flowy/workspace/presentation/home/navigation.dart';
  4. import 'package:flowy_infra/size.dart';
  5. import 'package:flowy_infra_ui/widget/rounded_button.dart';
  6. import 'package:flowy_infra_ui/widget/spacing.dart';
  7. import 'package:flowy_sdk/protobuf/flowy-workspace-infra/view_create.pb.dart';
  8. import 'package:flowy_sdk/protobuf/flowy-workspace-infra/view_create.pbenum.dart';
  9. import 'package:flutter/material.dart';
  10. import 'package:flowy_infra_ui/style_widget/extension.dart';
  11. import 'package:flowy_infra_ui/style_widget/text.dart';
  12. class HomeTopBar extends StatelessWidget {
  13. const HomeTopBar({Key? key}) : super(key: key);
  14. @override
  15. Widget build(BuildContext context) {
  16. return SizedBox(
  17. height: HomeSizes.topBarHeight,
  18. child: Row(
  19. crossAxisAlignment: CrossAxisAlignment.center,
  20. children: [
  21. const FlowyNavigation(),
  22. const Spacer(),
  23. _renderShareButton(),
  24. // _renderMoreButton(),
  25. ],
  26. )
  27. .padding(
  28. horizontal: HomeInsets.topBarTitlePadding,
  29. )
  30. .bottomBorder(color: Colors.grey.shade300),
  31. );
  32. }
  33. Widget _renderShareButton() {
  34. return RoundedTextButton(
  35. title: 'Share',
  36. height: 30,
  37. width: 60,
  38. fontSize: 12,
  39. borderRadius: Corners.s6Border,
  40. color: Colors.lightBlue,
  41. onPressed: () {
  42. debugPrint('share page');
  43. },
  44. );
  45. }
  46. }
  47. class HomeTitle extends StatelessWidget {
  48. final String title;
  49. final ViewType type;
  50. const HomeTitle({
  51. Key? key,
  52. required this.title,
  53. required this.type,
  54. }) : super(key: key);
  55. @override
  56. Widget build(BuildContext context) {
  57. return Flexible(
  58. child: Row(
  59. children: [
  60. Image(fit: BoxFit.scaleDown, width: 15, height: 15, image: assetImageForViewType(type)),
  61. const HSpace(6),
  62. FlowyText(title, fontSize: 16),
  63. ],
  64. ),
  65. );
  66. }
  67. }