chore: mobile grid dark mode improvements (#4821)

* chore: field type grid

* chore: don't allow hiding primary field

* chore: bottom sheets

* chore: checklist bottom sheet
This commit is contained in:
Richard Shiue 2024-03-05 15:44:16 +08:00 committed by GitHub
parent c8e86f4f26
commit ff8eb0d479
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 46 additions and 30 deletions

View File

@ -20,6 +20,7 @@ class OptionColorList extends StatelessWidget {
crossAxisCount: 6, crossAxisCount: 6,
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero,
children: SelectOptionColorPB.values.map( children: SelectOptionColorPB.values.map(
(colorPB) { (colorPB) {
final color = colorPB.toColor(context); final color = colorPB.toColor(context);

View File

@ -65,7 +65,7 @@ Future<T?> showMobileBottomSheet<T>(
backgroundColor ??= Theme.of(context).brightness == Brightness.light backgroundColor ??= Theme.of(context).brightness == Brightness.light
? const Color(0xFFF7F8FB) ? const Color(0xFFF7F8FB)
: const Color(0xFF626364); : const Color(0xFF23262B);
return showModalBottomSheet<T>( return showModalBottomSheet<T>(
context: context, context: context,

View File

@ -39,7 +39,7 @@ Future<T?> showTransitionMobileBottomSheet<T>(
backgroundColor ??= Theme.of(context).brightness == Brightness.light backgroundColor ??= Theme.of(context).brightness == Brightness.light
? const Color(0xFFF7F8FB) ? const Color(0xFFF7F8FB)
: const Color(0xFF626364); : const Color(0xFF23262B);
return Navigator.of( return Navigator.of(
context, context,

View File

@ -55,7 +55,7 @@ class _MobileDateCellEditScreenState extends State<MobileDateCellEditScreen> {
minChildSize: 0.4, minChildSize: 0.4,
snapSizes: const [0.4, 0.7, 1.0], snapSizes: const [0.4, 0.7, 1.0],
builder: (_, controller) => Material( builder: (_, controller) => Material(
color: Theme.of(context).colorScheme.secondaryContainer, color: Colors.transparent,
child: ListView( child: ListView(
controller: controller, controller: controller,
children: [ children: [

View File

@ -47,7 +47,9 @@ Future<FieldType?> showFieldTypeGridBottomSheet(
.map( .map(
(fieldType) => TypeOptionMenuItemValue( (fieldType) => TypeOptionMenuItemValue(
value: fieldType, value: fieldType,
backgroundColor: fieldType.mobileIconBackgroundColor, backgroundColor: Theme.of(context).brightness == Brightness.light
? fieldType.mobileIconBackgroundColor
: fieldType.mobileIconBackgroundColorDark,
text: fieldType.i18n, text: fieldType.i18n,
icon: fieldType.svgData, icon: fieldType.svgData,
onTap: (context, fieldType) => onTap: (context, fieldType) =>
@ -121,7 +123,6 @@ void showQuickEditField(
) { ) {
showMobileBottomSheet( showMobileBottomSheet(
context, context,
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
showDragHandle: true, showDragHandle: true,
builder: (context) { builder: (context) {
return SingleChildScrollView( return SingleChildScrollView(

View File

@ -208,7 +208,9 @@ class _MobileFieldEditorState extends State<MobileFieldEditor> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final option = _buildOption(); final option = _buildOption();
return Container( return Container(
color: Theme.of(context).colorScheme.secondaryContainer, color: Theme.of(context).brightness == Brightness.light
? const Color(0xFFF7F8FB)
: const Color(0xFF23262B),
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
@ -259,6 +261,7 @@ class _MobileFieldEditorState extends State<MobileFieldEditor> {
], ],
..._buildOptionActions(), ..._buildOptionActions(),
const _Divider(), const _Divider(),
VSpace(MediaQuery.viewPaddingOf(context).bottom == 0 ? 28.0 : 16.0),
], ],
), ),
), ),
@ -351,7 +354,7 @@ class _MobileFieldEditorState extends State<MobileFieldEditor> {
} }
return [ return [
if (widget.actions.contains(FieldOptionAction.hide)) if (widget.actions.contains(FieldOptionAction.hide) && !widget.isPrimary)
FlowyOptionTile.text( FlowyOptionTile.text(
text: LocaleKeys.grid_field_hide.tr(), text: LocaleKeys.grid_field_hide.tr(),
leftIcon: const FlowySvg(FlowySvgs.m_field_hide_s), leftIcon: const FlowySvg(FlowySvgs.m_field_hide_s),

View File

@ -87,7 +87,11 @@ class _DatabaseViewSelectorButton extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
), ),
), ),
backgroundColor: const MaterialStatePropertyAll(Color(0x0F212729)), backgroundColor: MaterialStatePropertyAll(
Theme.of(context).brightness == Brightness.light
? const Color(0x0F212729)
: const Color(0x0FFFFFFF),
),
overlayColor: MaterialStatePropertyAll( overlayColor: MaterialStatePropertyAll(
Theme.of(context).colorScheme.secondary, Theme.of(context).colorScheme.secondary,
), ),

View File

@ -39,7 +39,6 @@ class MobileGridChecklistCellSkin extends IEditableChecklistCellSkin {
), ),
onTap: () => showMobileBottomSheet( onTap: () => showMobileBottomSheet(
context, context,
backgroundColor: Theme.of(context).colorScheme.background,
builder: (context) { builder: (context) {
return BlocProvider.value( return BlocProvider.value(
value: bloc, value: bloc,

View File

@ -44,7 +44,6 @@ class MobileGridDateCellSkin extends IEditableDateCellSkin {
onTap: () { onTap: () {
showMobileBottomSheet( showMobileBottomSheet(
context, context,
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
builder: (context) { builder: (context) {
return MobileDateCellEditScreen( return MobileDateCellEditScreen(
controller: bloc.cellController, controller: bloc.cellController,

View File

@ -230,7 +230,7 @@ class _ChecklistItemState extends State<_ChecklistItem> {
void _showDeleteTaskBottomSheet() { void _showDeleteTaskBottomSheet() {
showMobileBottomSheet( showMobileBottomSheet(
context, context,
padding: const EdgeInsets.only(top: 8, bottom: 32), showDragHandle: true,
builder: (_) => Column( builder: (_) => Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [

View File

@ -421,7 +421,6 @@ class _MoreOptionsState extends State<_MoreOptions> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final color = Theme.of(context).colorScheme.secondaryContainer;
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -432,22 +431,18 @@ class _MoreOptionsState extends State<_MoreOptions> {
const VSpace(16.0), const VSpace(16.0),
Padding( Padding(
padding: const EdgeInsets.only(left: 12.0), padding: const EdgeInsets.only(left: 12.0),
child: ColoredBox( child: FlowyText(
color: color, LocaleKeys.grid_selectOption_colorPanelTitle.tr().toUpperCase(),
child: FlowyText( color: Theme.of(context).hintColor,
LocaleKeys.grid_selectOption_colorPanelTitle.tr().toUpperCase(), fontSize: 13,
color: Theme.of(context).hintColor,
fontSize: 13,
),
), ),
), ),
const VSpace(4.0), const VSpace(4.0),
FlowyOptionDecorateBox( FlowyOptionDecorateBox(
child: Padding( child: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.symmetric(
top: 12.0, vertical: 12.0,
left: 6.0, horizontal: 6.0,
right: 6.0,
), ),
child: OptionColorList( child: OptionColorList(
selectedColor: option.color, selectedColor: option.color,

View File

@ -147,7 +147,6 @@ void _showEditSortPanelFromToolbar(
) { ) {
showMobileBottomSheet( showMobileBottomSheet(
context, context,
backgroundColor: Theme.of(context).colorScheme.surface,
showDragHandle: true, showDragHandle: true,
showDivider: false, showDivider: false,
useSafeArea: false, useSafeArea: false,

View File

@ -42,14 +42,30 @@ extension FieldTypeExtension on FieldType {
Color get mobileIconBackgroundColor => switch (this) { Color get mobileIconBackgroundColor => switch (this) {
FieldType.RichText => const Color(0xFFBECCFF), FieldType.RichText => const Color(0xFFBECCFF),
FieldType.Number => const Color(0xFFCABDFF), FieldType.Number => const Color(0xFFCABDFF),
FieldType.DateTime => const Color(0xFFFDEDA7), FieldType.URL => const Color(0xFFFFB9EF),
FieldType.SingleSelect => const Color(0xFFBECCFF), FieldType.SingleSelect => const Color(0xFFBECCFF),
FieldType.MultiSelect => const Color(0xFFBECCFF), FieldType.MultiSelect => const Color(0xFFBECCFF),
FieldType.URL => const Color(0xFFFFB9EF), FieldType.DateTime => const Color(0xFFFDEDA7),
FieldType.Checkbox => const Color(0xFF98F4CD),
FieldType.Checklist => const Color(0xFF98F4CD),
FieldType.LastEditedTime => const Color(0xFFFDEDA7), FieldType.LastEditedTime => const Color(0xFFFDEDA7),
FieldType.CreatedTime => const Color(0xFFFDEDA7), FieldType.CreatedTime => const Color(0xFFFDEDA7),
FieldType.Checkbox => const Color(0xFF98F4CD),
FieldType.Checklist => const Color(0xFF98F4CD),
FieldType.Relation => const Color(0xFFFDEDA7),
_ => throw UnimplementedError(),
};
// TODO(RS): inner icon color isn't always white
Color get mobileIconBackgroundColorDark => switch (this) {
FieldType.RichText => const Color(0xFF6859A7),
FieldType.Number => const Color(0xFF6859A7),
FieldType.URL => const Color(0xFFA75C96),
FieldType.SingleSelect => const Color(0xFF5366AB),
FieldType.MultiSelect => const Color(0xFF5366AB),
FieldType.DateTime => const Color(0xFFB0A26D),
FieldType.LastEditedTime => const Color(0xFFB0A26D),
FieldType.CreatedTime => const Color(0xFFB0A26D),
FieldType.Checkbox => const Color(0xFF42AD93),
FieldType.Checklist => const Color(0xFF42AD93),
FieldType.Relation => const Color(0xFFFDEDA7), FieldType.Relation => const Color(0xFFFDEDA7),
_ => throw UnimplementedError(), _ => throw UnimplementedError(),
}; };

View File

@ -74,10 +74,9 @@ class MobileAppearance extends BaseAppearance {
outline: _hintColorInDarkMode, outline: _hintColorInDarkMode,
outlineVariant: Colors.black, outlineVariant: Colors.black,
//Snack bar //Snack bar
surface: const Color(0xff2F3030), surface: const Color(0xFF171A1F),
onSurface: const Color(0xffC5C6C7), // text/body color onSurface: const Color(0xffC5C6C7), // text/body color
); );
final hintColor = brightness == Brightness.light final hintColor = brightness == Brightness.light
? const Color(0x991F2329) ? const Color(0x991F2329)
: _hintColorInDarkMode; : _hintColorInDarkMode;