fix: multiple UI issues (#2249)

* fix: put original borderRadius back to FieldCellButton

* chore: remove the border of card when it is in dark mode

* chore: update NavigatorTextFieldDialog style and organize Insets

* chore: delete unnecessary nullable field
This commit is contained in:
Yijing Huang 2023-04-14 01:21:10 -04:00 committed by GitHub
parent 01ced3bdc0
commit b451303156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 24 deletions

View File

@ -292,9 +292,10 @@ class _BoardContentState extends State<BoardContent> {
color: Theme.of(context).dividerColor, color: Theme.of(context).dividerColor,
width: 1.0, width: 1.0,
); );
final isLightMode = Theme.of(context).brightness == Brightness.light;
return BoxDecoration( return BoxDecoration(
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.surface,
border: Border.fromBorderSide(borderSide), border: isLightMode ? Border.fromBorderSide(borderSide) : null,
borderRadius: const BorderRadius.all(Radius.circular(6)), borderRadius: const BorderRadius.all(Radius.circular(6)),
); );
} }

View File

@ -152,10 +152,12 @@ class FieldCellButton extends StatelessWidget {
final VoidCallback onTap; final VoidCallback onTap;
final FieldPB field; final FieldPB field;
final int? maxLines; final int? maxLines;
final BorderRadius? radius;
const FieldCellButton({ const FieldCellButton({
required this.field, required this.field,
required this.onTap, required this.onTap,
this.maxLines = 1, this.maxLines = 1,
this.radius = BorderRadius.zero,
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
@ -172,7 +174,7 @@ class FieldCellButton extends StatelessWidget {
leftIcon: FlowySvg( leftIcon: FlowySvg(
name: field.fieldType.iconName(), name: field.fieldType.iconName(),
), ),
radius: BorderRadius.circular(6), radius: radius,
text: FlowyText.medium( text: FlowyText.medium(
text, text,
maxLines: maxLines, maxLines: maxLines,

View File

@ -301,6 +301,7 @@ class _PropertyCellState extends State<_PropertyCell> {
child: FieldCellButton( child: FieldCellButton(
field: widget.cellId.fieldInfo.field, field: widget.cellId.fieldInfo.field,
onTap: () => popover.show(), onTap: () => popover.show(),
radius: BorderRadius.circular(6),
), ),
), ),
), ),

View File

@ -10,7 +10,6 @@ import 'package:flowy_infra_ui/style_widget/text_input.dart';
import 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart'; import 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart';
export 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart'; export 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart';
import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:textstyle_extensions/textstyle_extensions.dart';
class NavigatorTextFieldDialog extends StatefulWidget { class NavigatorTextFieldDialog extends StatefulWidget {
final String value; final String value;
@ -43,21 +42,20 @@ class _CreateTextFieldDialog extends State<NavigatorTextFieldDialog> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StyledDialog( return StyledDialog(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
...[ FlowyText.medium(
FlowyText.medium( widget.title,
widget.title, color: Theme.of(context).colorScheme.tertiary,
color: Theme.of(context).disabledColor, fontSize: FontSizes.s16,
fontSize: FontSizes.s16, ),
), VSpace(Insets.m),
VSpace(Insets.sm * 1.5),
],
FlowyFormTextInput( FlowyFormTextInput(
textAlign: TextAlign.center,
hintText: LocaleKeys.dialogCreatePageNameHint.tr(), hintText: LocaleKeys.dialogCreatePageNameHint.tr(),
initialValue: widget.value, initialValue: widget.value,
textStyle: textStyle: Theme.of(context).textTheme.bodySmall?.copyWith(
Theme.of(context).textTheme.bodySmall!.size(FontSizes.s24), fontSize: FontSizes.s16,
),
autoFocus: true, autoFocus: true,
onChanged: (text) { onChanged: (text) {
newValue = text; newValue = text;
@ -67,7 +65,7 @@ class _CreateTextFieldDialog extends State<NavigatorTextFieldDialog> {
AppGlobals.nav.pop(); AppGlobals.nav.pop();
}, },
), ),
const VSpace(10), VSpace(Insets.xl),
OkCancelButton( OkCancelButton(
onOkPressed: () { onOkPressed: () {
widget.confirm(newValue); widget.confirm(newValue);
@ -206,6 +204,7 @@ class OkCancelButton extends StatelessWidget {
final String? okTitle; final String? okTitle;
final String? cancelTitle; final String? cancelTitle;
final double? minHeight; final double? minHeight;
final MainAxisAlignment alignment;
const OkCancelButton({ const OkCancelButton({
Key? key, Key? key,
@ -214,6 +213,7 @@ class OkCancelButton extends StatelessWidget {
this.okTitle, this.okTitle,
this.cancelTitle, this.cancelTitle,
this.minHeight, this.minHeight,
this.alignment = MainAxisAlignment.spaceAround,
}) : super(key: key); }) : super(key: key);
@override @override
@ -221,7 +221,7 @@ class OkCancelButton extends StatelessWidget {
return SizedBox( return SizedBox(
height: 48, height: 48,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: alignment,
children: <Widget>[ children: <Widget>[
if (onCancelPressed != null) if (onCancelPressed != null)
SecondaryTextButton( SecondaryTextButton(

View File

@ -11,14 +11,8 @@ class PageBreaks {
} }
class Insets { class Insets {
static double gutterScale = 1;
static double scale = 1;
/// Dynamic insets, may get scaled with the device size /// Dynamic insets, may get scaled with the device size
static double get mGutter => m * gutterScale; static double scale = 1;
static double get lGutter => l * gutterScale;
static double get xs => 2 * scale; static double get xs => 2 * scale;
@ -29,6 +23,10 @@ class Insets {
static double get l => 24 * scale; static double get l => 24 * scale;
static double get xl => 36 * scale; static double get xl => 36 * scale;
static double get xxl => 64 * scale;
static double get xxxl => 80 * scale;
} }
class FontSizes { class FontSizes {

View File

@ -15,6 +15,7 @@ class FlowyFormTextInput extends StatelessWidget {
final String? hintText; final String? hintText;
final EdgeInsets? contentPadding; final EdgeInsets? contentPadding;
final TextStyle? textStyle; final TextStyle? textStyle;
final TextAlign textAlign;
final int? maxLines; final int? maxLines;
final TextEditingController? controller; final TextEditingController? controller;
final TextCapitalization? capitalization; final TextCapitalization? capitalization;
@ -37,6 +38,7 @@ class FlowyFormTextInput extends StatelessWidget {
this.contentPadding, this.contentPadding,
this.capitalization, this.capitalization,
this.textStyle, this.textStyle,
this.textAlign = TextAlign.center,
this.maxLines}) this.maxLines})
: super(key: key); : super(key: key);
@ -50,6 +52,7 @@ class FlowyFormTextInput extends StatelessWidget {
onChanged: onChanged, onChanged: onChanged,
onFocusCreated: onFocusCreated, onFocusCreated: onFocusCreated,
style: textStyle ?? Theme.of(context).textTheme.bodyMedium, style: textStyle ?? Theme.of(context).textTheme.bodyMedium,
textAlign: textAlign,
onEditingComplete: onEditingComplete, onEditingComplete: onEditingComplete,
onFocusChanged: onFocusChanged, onFocusChanged: onFocusChanged,
controller: controller, controller: controller,
@ -69,6 +72,7 @@ class FlowyFormTextInput extends StatelessWidget {
class StyledSearchTextInput extends StatefulWidget { class StyledSearchTextInput extends StatefulWidget {
final String? label; final String? label;
final TextStyle? style; final TextStyle? style;
final TextAlign textAlign;
final EdgeInsets? contentPadding; final EdgeInsets? contentPadding;
final bool? autoFocus; final bool? autoFocus;
final bool? obscureText; final bool? obscureText;
@ -103,6 +107,7 @@ class StyledSearchTextInput extends StatefulWidget {
this.autoFocus = false, this.autoFocus = false,
this.obscureText = false, this.obscureText = false,
this.type = TextInputType.text, this.type = TextInputType.text,
this.textAlign = TextAlign.center,
this.icon, this.icon,
this.initialValue = '', this.initialValue = '',
this.controller, this.controller,
@ -201,6 +206,7 @@ class StyledSearchTextInputState extends State<StyledSearchTextInput> {
enabled: widget.enabled, enabled: widget.enabled,
maxLines: widget.maxLines, maxLines: widget.maxLines,
textCapitalization: widget.capitalization ?? TextCapitalization.none, textCapitalization: widget.capitalization ?? TextCapitalization.none,
textAlign: widget.textAlign,
decoration: widget.inputDecoration ?? decoration: widget.inputDecoration ??
InputDecoration( InputDecoration(
prefixIcon: widget.prefixIcon, prefixIcon: widget.prefixIcon,

View File

@ -49,7 +49,8 @@ class StyledDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget innerContent = Container( Widget innerContent = Container(
padding: padding ?? EdgeInsets.all(Insets.lGutter), padding: padding ??
EdgeInsets.symmetric(horizontal: Insets.xxl, vertical: Insets.xl),
color: bgColor ?? Theme.of(context).colorScheme.surface, color: bgColor ?? Theme.of(context).colorScheme.surface,
child: child, child: child,
); );