feat(flutter_desktop): use regular rather than medium font weight by default (#6432)

* feat(flutter_desktop): use regular rather than medium by default

* fix: setting button regression

* fix: bring more text styles up to date with design
This commit is contained in:
Richard Shiue 2024-09-30 21:37:11 +08:00 committed by GitHub
parent cc9072e9cc
commit 7ac3b72a4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 41 additions and 38 deletions

View File

@ -521,7 +521,7 @@ class _BoardColumnFooterState extends State<BoardColumnFooter> {
FlowySvgs.add_s,
color: Theme.of(context).hintColor,
),
text: FlowyText.medium(
text: FlowyText(
LocaleKeys.board_column_createNewCard.tr(),
color: Theme.of(context).hintColor,
),

View File

@ -118,7 +118,7 @@ class GroupOptionsButton extends StatelessWidget {
height: GridSize.popoverItemHeight,
child: FlowyButton(
leftIcon: FlowySvg(action.icon),
text: FlowyText.medium(
text: FlowyText(
action.text,
lineHeight: 1.0,
overflow: TextOverflow.ellipsis,

View File

@ -279,14 +279,14 @@ class HiddenGroupButtonContent extends StatelessWidget {
index: index,
),
const HSpace(4),
FlowyText.medium(
FlowyText(
group
.generateGroupName(bloc.databaseController),
overflow: TextOverflow.ellipsis,
),
const HSpace(6),
Expanded(
child: FlowyText.medium(
child: FlowyText(
group.rows.length.toString(),
overflow: TextOverflow.ellipsis,
color: Theme.of(context).hintColor,
@ -387,7 +387,7 @@ class HiddenGroupPopupItemList extends StatelessWidget {
final cells = <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
child: FlowyText.medium(
child: FlowyText(
group.generateGroupName(bloc.databaseController),
fontSize: 10,
color: Theme.of(context).hintColor,
@ -471,7 +471,7 @@ class HiddenGroupPopupItem extends StatelessWidget {
text: cellBuilder.build(
cellContext: cellContext,
styleMap: {FieldType.RichText: _titleCellStyle(context)},
hasNotes: !rowMeta.isDocumentEmpty,
hasNotes: false,
),
onTap: onPressed,
),

View File

@ -326,7 +326,7 @@ class _DayBadge extends StatelessWidget {
width: isToday ? size : null,
height: isToday ? size : null,
child: Center(
child: FlowyText.medium(
child: FlowyText(
dayString,
fontSize: UniversalPlatform.isMobile ? 12 : 11,
color: dayTextColor,

View File

@ -453,7 +453,7 @@ class _UnscheduledEventsButtonState extends State<UnscheduledEventsButton> {
builder: (_) {
return Column(
children: [
FlowyText.medium(
FlowyText(
LocaleKeys.calendar_settings_unscheduledEventsTitle.tr(),
),
UnscheduleEventsList(
@ -482,7 +482,7 @@ class UnscheduleEventsList extends StatelessWidget {
if (!UniversalPlatform.isMobile)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
child: FlowyText.medium(
child: FlowyText(
LocaleKeys.calendar_settings_clickToAdd.tr(),
fontSize: 10,
color: Theme.of(context).hintColor,
@ -565,7 +565,7 @@ class DesktopUnscheduledEventTile extends StatelessWidget {
height: 26,
child: FlowyButton(
margin: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
text: FlowyText.medium(
text: FlowyText(
event.title.isEmpty
? LocaleKeys.calendar_defaultNewCalendarTitle.tr()
: event.title,

View File

@ -173,7 +173,7 @@ class LayoutDateField extends StatelessWidget {
return SizedBox(
height: GridSize.popoverItemHeight,
child: FlowyButton(
text: FlowyText.medium(
text: FlowyText(
fieldInfo.name,
lineHeight: 1.0,
),
@ -208,7 +208,7 @@ class LayoutDateField extends StatelessWidget {
height: GridSize.popoverItemHeight,
child: FlowyButton(
margin: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 10.0),
text: FlowyText.medium(
text: FlowyText(
lineHeight: 1.0,
LocaleKeys.calendar_settings_layoutDateField.tr(),
),
@ -310,7 +310,7 @@ class FirstDayOfWeek extends StatelessWidget {
height: GridSize.popoverItemHeight,
child: FlowyButton(
margin: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 10.0),
text: FlowyText.medium(
text: FlowyText(
lineHeight: 1.0,
LocaleKeys.calendar_settings_firstDayOfWeek.tr(),
),
@ -331,7 +331,7 @@ Widget _toggleItem({
padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 10.0),
child: Row(
children: [
FlowyText.medium(text),
FlowyText(text),
const Spacer(),
Toggle(
value: value,
@ -372,7 +372,7 @@ class StartFromButton extends StatelessWidget {
return SizedBox(
height: GridSize.popoverItemHeight,
child: FlowyButton(
text: FlowyText.medium(
text: FlowyText(
title,
lineHeight: 1.0,
),

View File

@ -22,7 +22,7 @@ class CalculationTypeItem extends StatelessWidget {
return SizedBox(
height: GridSize.popoverItemHeight,
child: FlowyButton(
text: FlowyText.medium(
text: FlowyText(
type.label,
overflow: TextOverflow.ellipsis,
lineHeight: 1.0,

View File

@ -20,7 +20,7 @@ class RemoveCalculationButton extends StatelessWidget {
return SizedBox(
height: GridSize.popoverItemHeight,
child: FlowyButton(
text: FlowyText.medium(
text: FlowyText(
LocaleKeys.grid_calculationTypeLabel_none.tr(),
overflow: TextOverflow.ellipsis,
),

View File

@ -103,7 +103,7 @@ class TabBarAddButtonActionCell extends StatelessWidget {
height: GridSize.popoverItemHeight,
child: FlowyButton(
hoverColor: AFThemeExtension.of(context).lightGreyHover,
text: FlowyText.medium(
text: FlowyText(
'${LocaleKeys.grid_createView.tr()} ${action.layoutName}',
color: AFThemeExtension.of(context).textColor,
),

View File

@ -104,7 +104,7 @@ class _DatabaseViewSelectorButton extends StatelessWidget {
Flexible(
child: FlowyText.medium(
tabBar.view.name,
fontSize: 13,
fontSize: 14,
overflow: TextOverflow.ellipsis,
),
),

View File

@ -54,7 +54,7 @@ class DesktopGridRelationCellSkin extends IEditableRelationCellSkin {
children: rows.map(
(row) {
final isEmpty = row.name.isEmpty;
return FlowyText.medium(
return FlowyText(
isEmpty ? LocaleKeys.grid_row_titlePlaceholder.tr() : row.name,
color: isEmpty ? Theme.of(context).hintColor : null,
decoration: TextDecoration.underline,
@ -81,7 +81,7 @@ class DesktopGridRelationCellSkin extends IEditableRelationCellSkin {
children: rows.map(
(row) {
final isEmpty = row.name.isEmpty;
return FlowyText.medium(
return FlowyText(
isEmpty ? LocaleKeys.grid_row_titlePlaceholder.tr() : row.name,
color: isEmpty ? Theme.of(context).hintColor : null,
decoration: TextDecoration.underline,

View File

@ -28,7 +28,15 @@ class DesktopGridTextCellSkin extends IEditableTextCellSkin {
controller: textEditingController,
focusNode: focusNode,
maxLines: context.watch<TextCellBloc>().state.wrap ? null : 1,
style: Theme.of(context).textTheme.bodyMedium,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: context
.read<TextCellBloc>()
.cellController
.fieldInfo
.isPrimary
? FontWeight.w500
: null,
),
decoration: const InputDecoration(
contentPadding: EdgeInsets.only(top: 4),
border: InputBorder.none,

View File

@ -36,7 +36,7 @@ class DesktopRowDetailDateCellSkin extends IEditableDateCellSkin {
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: FlowyText.medium(
child: FlowyText(
text,
color: color,
overflow: TextOverflow.ellipsis,

View File

@ -81,7 +81,7 @@ class DekstopRowDetailMediaCellSkin extends IEditableMediaCellSkin {
horizontal: 8,
vertical: 6,
),
child: FlowyText.medium(
child: FlowyText(
LocaleKeys.grid_row_textPlaceholder.tr(),
color: Theme.of(context).hintColor,
overflow: TextOverflow.ellipsis,
@ -542,7 +542,7 @@ class _FilePreviewRenderState extends State<_FilePreviewRender> {
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Center(
child: FlowyText.medium(
child: FlowyText(
file.name,
overflow: TextOverflow.ellipsis,
fontSize: 12,

View File

@ -56,7 +56,7 @@ class DesktopRowDetailRelationCellSkin extends IEditableRelationCellSkin {
children: rows.map(
(row) {
final isEmpty = row.name.isEmpty;
return FlowyText.medium(
return FlowyText(
isEmpty ? LocaleKeys.grid_row_titlePlaceholder.tr() : row.name,
color: isEmpty ? Theme.of(context).hintColor : null,
decoration: TextDecoration.underline,

View File

@ -16,7 +16,7 @@ class DesktopRowDetailTimestampCellSkin extends IEditableTimestampCellSkin {
return Container(
alignment: AlignmentDirectional.centerStart,
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6.0),
child: FlowyText.medium(
child: FlowyText(
state.dateStr,
maxLines: null,
),

View File

@ -27,7 +27,7 @@ class MobileRowDetailTimestampCellSkin extends IEditableTimestampCellSkin {
borderRadius: const BorderRadius.all(Radius.circular(14)),
),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 13),
child: FlowyText.medium(
child: FlowyText(
state.dateStr.isEmpty
? LocaleKeys.grid_row_textPlaceholder.tr()
: state.dateStr,

View File

@ -391,7 +391,7 @@ class _CreateOptionCell extends StatelessWidget {
onTap: onTap,
child: Row(
children: [
FlowyText.medium(
FlowyText(
LocaleKeys.grid_selectOption_create.tr(),
color: Theme.of(context).hintColor,
),

View File

@ -344,7 +344,7 @@ class ToggleHiddenFieldsVisibilityButton extends StatelessWidget {
EdgeInsets.symmetric(vertical: 14, horizontal: 6),
),
),
label: FlowyText.medium(
label: FlowyText(
text,
fontSize: 15,
color: Theme.of(context).hintColor,

View File

@ -2,7 +2,6 @@ import 'package:appflowy/shared/google_fonts_extension.dart';
import 'package:flowy_infra/size.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flutter/material.dart';
import 'package:universal_platform/universal_platform.dart';
// the default font family is empty, so we can use the default font family of the platform
// the system will choose the default font family of the platform
@ -31,8 +30,7 @@ abstract class BaseAppearance {
double? lineHeight,
}) {
fontSize = fontSize ?? FontSizes.s14;
fontWeight = fontWeight ??
(UniversalPlatform.isDesktopOrWeb ? FontWeight.w500 : FontWeight.w400);
fontWeight = fontWeight ?? FontWeight.w400;
letterSpacing = fontSize * (letterSpacing ?? 0.005);
final textStyle = TextStyle(

View File

@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flowy_infra/size.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
import 'package:flowy_infra_ui/widget/ignore_parent_gesture.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
@ -390,13 +389,10 @@ class FlowyTextButton extends StatelessWidget {
children.add(heading!);
children.add(const HSpace(8));
}
children.add(FlowyText(
children.add(Text(
text,
overflow: overflow,
color: fontColor ?? Theme.of(context).colorScheme.onPrimary,
textAlign: TextAlign.center,
lineHeight: lineHeight,
fontSize: fontSize,
));
Widget child = Row(
@ -431,6 +427,7 @@ class FlowyTextButton extends StatelessWidget {
TextStyle(
fontWeight: fontWeight ?? FontWeight.w500,
fontSize: fontSize,
color: fontColor ?? Theme.of(context).colorScheme.onPrimary,
decoration: decoration,
fontFamily: fontFamily,
height: lineHeight ?? 1.1,