Fix: mobile improvements (#4480)

* fix: copy on notifications screen is caught off

* fix: mobile event screen no events copy

* fix: hide notifications toggle from settings

* fix: cannot change type of field in grid
This commit is contained in:
Mathias Mogensen 2024-01-24 12:07:02 +01:00 committed by GitHub
parent 827e41348b
commit 8105da1c2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 91 additions and 42 deletions

View File

@ -179,7 +179,7 @@ SPEC CHECKSUMS:
file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de
flowy_infra_ui: 0455e1fa8c51885aa1437848e361e99419f34ebc flowy_infra_ui: 0455e1fa8c51885aa1437848e361e99419f34ebc
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
@ -202,4 +202,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 8c681999c7764593c94846b2a64b44d86f7a27ac PODFILE CHECKSUM: 8c681999c7764593c94846b2a64b44d86f7a27ac
COCOAPODS: 1.12.1 COCOAPODS: 1.14.3

View File

@ -1,3 +1,5 @@
import 'package:flutter/material.dart';
import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/presentation/base/app_bar_actions.dart'; import 'package:appflowy/mobile/presentation/base/app_bar_actions.dart';
import 'package:appflowy/mobile/presentation/database/field/mobile_field_type_option_editor.dart'; import 'package:appflowy/mobile/presentation/database/field/mobile_field_type_option_editor.dart';
@ -7,7 +9,6 @@ import 'package:appflowy/plugins/database/application/field/field_service.dart';
import 'package:appflowy/plugins/database/widgets/setting/field_visibility_extension.dart'; import 'package:appflowy/plugins/database/widgets/setting/field_visibility_extension.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
class MobileEditPropertyScreen extends StatefulWidget { class MobileEditPropertyScreen extends StatefulWidget {
@ -75,7 +76,7 @@ class _MobileEditPropertyScreenState extends State<MobileEditPropertyScreen> {
await fieldService.updateField(name: newField.name); await fieldService.updateField(name: newField.name);
} }
if (newField.type != field.type) { if (newField.type != widget.field.fieldType) {
await fieldService.updateFieldType(fieldType: newField.type); await fieldService.updateFieldType(fieldType: newField.type);
} }

View File

@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart'; import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart';
import 'package:appflowy/plugins/database/application/field/field_controller.dart'; import 'package:appflowy/plugins/database/application/field/field_controller.dart';
import 'package:appflowy/plugins/database/application/field/field_info.dart'; import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'mobile_create_field_screen.dart'; import 'mobile_create_field_screen.dart';

View File

@ -202,9 +202,10 @@ class _FieldOptionEditorState extends State<FieldOptionEditor> {
() { () {
if (widget.mode == FieldOptionMode.add) { if (widget.mode == FieldOptionMode.add) {
controller.text = type.i18n; controller.text = type.i18n;
_updateOptionValues(name: type.i18n); _updateOptionValues(name: type.i18n, type: type);
} else {
_updateOptionValues(type: type);
} }
_updateOptionValues(type: type);
}, },
), ),
), ),

View File

@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
class MobileCalendarEventsEmpty extends StatelessWidget {
const MobileCalendarEventsEmpty({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FlowyText(
LocaleKeys.calendar_mobileEventScreen_emptyTitle.tr(),
fontWeight: FontWeight.w700,
fontSize: 14,
),
const VSpace(8),
FlowyText.regular(
LocaleKeys.calendar_mobileEventScreen_emptyBody.tr(),
textAlign: TextAlign.center,
maxLines: 2,
),
],
),
),
);
}
}

View File

@ -1,3 +1,6 @@
import 'package:flutter/material.dart';
import 'package:appflowy/mobile/presentation/database/mobile_calendar_events_empty.dart';
import 'package:appflowy/plugins/database/application/row/row_cache.dart'; import 'package:appflowy/plugins/database/application/row/row_cache.dart';
import 'package:appflowy/plugins/database/calendar/application/calendar_bloc.dart'; import 'package:appflowy/plugins/database/calendar/application/calendar_bloc.dart';
import 'package:appflowy/plugins/database/calendar/presentation/calendar_event_card.dart'; import 'package:appflowy/plugins/database/calendar/presentation/calendar_event_card.dart';
@ -5,7 +8,6 @@ import 'package:calendar_view/calendar_view.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/widget/spacing.dart'; import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
class MobileCalendarEventsScreen extends StatefulWidget { class MobileCalendarEventsScreen extends StatefulWidget {
@ -44,37 +46,40 @@ class _MobileCalendarEventsScreenState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocProvider<CalendarBloc>.value( return Scaffold(
value: widget.calendarBloc, floatingActionButton: FloatingActionButton(
child: BlocBuilder<CalendarBloc, CalendarState>( key: const Key('add_event_fab'),
buildWhen: (p, c) => elevation: 6,
p.newEvent != c.newEvent && backgroundColor: Theme.of(context).colorScheme.primary,
c.newEvent?.date.withoutTime == widget.date, foregroundColor: Theme.of(context).colorScheme.onPrimary,
builder: (context, state) { onPressed: () =>
if (state.newEvent?.event != null && widget.calendarBloc.add(CalendarEvent.createEvent(widget.date)),
_events child: const Text('+'),
.none((e) => e.eventId == state.newEvent!.event!.eventId) && ),
state.newEvent!.date.withoutTime == widget.date) { appBar: AppBar(
_events.add(state.newEvent!.event!); title: Text(
} DateFormat.yMMMMd(context.locale.toLanguageTag()).format(widget.date),
),
),
body: BlocProvider<CalendarBloc>.value(
value: widget.calendarBloc,
child: BlocBuilder<CalendarBloc, CalendarState>(
buildWhen: (p, c) =>
p.newEvent != c.newEvent &&
c.newEvent?.date.withoutTime == widget.date,
builder: (context, state) {
if (state.newEvent?.event != null &&
_events
.none((e) => e.eventId == state.newEvent!.event!.eventId) &&
state.newEvent!.date.withoutTime == widget.date) {
_events.add(state.newEvent!.event!);
}
return Scaffold( if (_events.isEmpty) {
floatingActionButton: FloatingActionButton( return const MobileCalendarEventsEmpty();
key: const Key('add_event_fab'), }
elevation: 6,
backgroundColor: Theme.of(context).colorScheme.primary, return SingleChildScrollView(
foregroundColor: Theme.of(context).colorScheme.onPrimary,
onPressed: () => widget.calendarBloc
.add(CalendarEvent.createEvent(widget.date)),
child: const Text('+'),
),
appBar: AppBar(
title: Text(
DateFormat.yMMMMd(context.locale.toLanguageTag())
.format(widget.date),
),
),
body: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
const VSpace(10), const VSpace(10),
@ -95,9 +100,9 @@ class _MobileCalendarEventsScreenState
const VSpace(24), const VSpace(24),
], ],
), ),
), );
); },
}, ),
), ),
); );
} }

View File

@ -75,7 +75,8 @@ class _MobileHomeSettingPageState extends State<MobileHomeSettingPage> {
PersonalInfoSettingGroup( PersonalInfoSettingGroup(
userProfile: userProfile, userProfile: userProfile,
), ),
const NotificationsSettingGroup(), // TODO: Enable and implement along with Push Notifications
// const NotificationsSettingGroup(),
const AppearanceSettingGroup(), const AppearanceSettingGroup(),
const LanguageSettingGroup(), const LanguageSettingGroup(),
if (Env.enableCustomCloud) const CloudSettingGroup(), if (Env.enableCustomCloud) const CloudSettingGroup(),

View File

@ -24,6 +24,7 @@ class NotificationsHubEmpty extends StatelessWidget {
FlowyText.regular( FlowyText.regular(
LocaleKeys.notificationHub_emptyBody.tr(), LocaleKeys.notificationHub_emptyBody.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
maxLines: 2,
), ),
], ],
), ),

View File

@ -917,6 +917,10 @@
"previousMonth": "Previous Month", "previousMonth": "Previous Month",
"nextMonth": "Next Month" "nextMonth": "Next Month"
}, },
"mobileEventScreen": {
"emptyTitle": "No events yet",
"emptyBody": "Press the plus button to create an event on this day."
},
"settings": { "settings": {
"showWeekNumbers": "Show week numbers", "showWeekNumbers": "Show week numbers",
"showWeekends": "Show weekends", "showWeekends": "Show weekends",