Skip to content

Commit

Permalink
chore: add a checkmark if the page has been published
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Jul 8, 2024
1 parent 487c16f commit ddab180
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/presentation/home/tab/_round_underline_tab_indicator.dart';
import 'package:appflowy/plugins/document/application/document_share_bloc.dart';
import 'package:appflowy/plugins/document/presentation/share/export_tab.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'publish_tab.dart';

Expand Down Expand Up @@ -86,15 +89,15 @@ class _ShareMenuState extends State<ShareMenu>
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: _Segment(
title: tab.i18n.tr(),
tab: tab,
isSelected: selectedTab == tab,
),
),
];
return TabBar(
indicatorSize: TabBarIndicatorSize.label,
indicator: RoundUnderlineTabIndicator(
width: 48.0,
width: 68.0,
borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary,
width: 3,
Expand Down Expand Up @@ -128,12 +131,12 @@ class _ShareMenuState extends State<ShareMenu>

class _Segment extends StatefulWidget {
const _Segment({
required this.title,
required this.tab,
required this.isSelected,
});

final String title;
final bool isSelected;
final ShareMenuTab tab;

@override
State<_Segment> createState() => _SegmentState();
Expand All @@ -150,14 +153,34 @@ class _SegmentState extends State<_Segment> {
} else if (widget.isSelected) {
textColor = null;
}
return MouseRegion(

Widget child = MouseRegion(
onEnter: (_) => setState(() => isHovered = true),
onExit: (_) => setState(() => isHovered = false),
child: FlowyText(
widget.title,
widget.tab.i18n,
textAlign: TextAlign.center,
color: textColor,
),
);

if (widget.tab == ShareMenuTab.publish) {
final isPublished = context.watch<DocumentShareBloc>().state.isPublished;
// show checkmark icon if published
if (isPublished) {
child = Row(
children: [
const FlowySvg(
FlowySvgs.published_checkmark_s,
blendMode: null,
),
const HSpace(6),
child,
],
);
}
}

return child;
}
}
11 changes: 11 additions & 0 deletions frontend/resources/flowy_icons/16x/published_checkmark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ddab180

Please sign in to comment.