mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: add time to view meta info (#4769)
This commit is contained in:
parent
abd08e5e53
commit
0cffe42d80
@ -8,7 +8,6 @@ import 'package:appflowy/workspace/presentation/widgets/more_view_actions/widget
|
||||
import 'package:appflowy/workspace/presentation/widgets/more_view_actions/widgets/font_size_action.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/more_view_actions/widgets/view_meta_info.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-user/date_time.pbenum.dart';
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
@ -35,13 +34,11 @@ class MoreViewActions extends StatefulWidget {
|
||||
|
||||
class _MoreViewActionsState extends State<MoreViewActions> {
|
||||
late final List<Widget> viewActions;
|
||||
late final UserDateFormatPB dateFormat;
|
||||
final popoverMutex = PopoverMutex();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
dateFormat = context.read<AppearanceSettingsCubit>().state.dateFormat;
|
||||
viewActions = ViewActionType.values
|
||||
.map(
|
||||
(type) => ViewAction(
|
||||
@ -61,11 +58,15 @@ class _MoreViewActionsState extends State<MoreViewActions> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appearanceSettings = context.watch<AppearanceSettingsCubit>().state;
|
||||
final dateFormat = appearanceSettings.dateFormat;
|
||||
final timeFormat = appearanceSettings.timeFormat;
|
||||
|
||||
return BlocBuilder<ViewInfoBloc, ViewInfoState>(
|
||||
builder: (context, state) {
|
||||
return AppFlowyPopover(
|
||||
mutex: popoverMutex,
|
||||
constraints: BoxConstraints.loose(const Size(200, 400)),
|
||||
constraints: BoxConstraints.loose(const Size(210, 400)),
|
||||
offset: const Offset(0, 30),
|
||||
popupBuilder: (_) {
|
||||
final actions = [
|
||||
@ -79,6 +80,7 @@ class _MoreViewActionsState extends State<MoreViewActions> {
|
||||
const Divider(height: 4),
|
||||
ViewMetaInfo(
|
||||
dateFormat: dateFormat,
|
||||
timeFormat: timeFormat,
|
||||
documentCounters: state.documentCounters,
|
||||
createdAt: state.createdAt,
|
||||
),
|
||||
|
@ -12,11 +12,13 @@ class ViewMetaInfo extends StatelessWidget {
|
||||
const ViewMetaInfo({
|
||||
super.key,
|
||||
required this.dateFormat,
|
||||
required this.timeFormat,
|
||||
this.documentCounters,
|
||||
this.createdAt,
|
||||
});
|
||||
|
||||
final UserDateFormatPB dateFormat;
|
||||
final UserTimeFormatPB timeFormat;
|
||||
final Counters? documentCounters;
|
||||
final DateTime? createdAt;
|
||||
|
||||
@ -47,8 +49,9 @@ class ViewMetaInfo extends StatelessWidget {
|
||||
if (documentCounters != null) const VSpace(2),
|
||||
FlowyText.regular(
|
||||
LocaleKeys.moreAction_createdAt.tr(
|
||||
args: [dateFormat.formatDate(createdAt!, false)],
|
||||
args: [dateFormat.formatDate(createdAt!, true, timeFormat)],
|
||||
),
|
||||
maxLines: 2,
|
||||
color: Theme.of(context).hintColor,
|
||||
),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user