Apply new style for create identity view on desktop
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -259,6 +259,7 @@ extension AppColor on Color {
|
||||
static const iconFolder = Color(0xFF297EF2);
|
||||
static const folderDivider = Color(0xFFE4E8EC);
|
||||
static const gray424244 = Color(0xFF424244);
|
||||
static const lightGrayF4F4F4 = Color(0xFFF4F4F4);
|
||||
static const redFF3347 = Color(0xFFFF3347);
|
||||
static const gray686E76 = Color(0xFF686E76);
|
||||
static const lightGrayEBEDF0 = Color(0xFFEBEDF0);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/views/checkbox/labeled_checkbox.dart';
|
||||
import 'package:core/presentation/views/semantics/checkbox_semantics.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
@@ -7,7 +8,8 @@ class CustomIconLabeledCheckbox extends LabeledCheckbox {
|
||||
|
||||
final String svgIconPath;
|
||||
final String selectedSvgIconPath;
|
||||
final FocusNode focusNode;
|
||||
final FocusNode? focusNode;
|
||||
final String? semanticsLabel;
|
||||
|
||||
const CustomIconLabeledCheckbox({
|
||||
super.key,
|
||||
@@ -15,31 +17,63 @@ class CustomIconLabeledCheckbox extends LabeledCheckbox {
|
||||
required super.onChanged,
|
||||
required this.svgIconPath,
|
||||
required this.selectedSvgIconPath,
|
||||
required this.focusNode,
|
||||
this.focusNode,
|
||||
this.semanticsLabel,
|
||||
super.value,
|
||||
super.gap = 16.0,
|
||||
super.padding,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget get buildCheckboxWidget => FocusableActionDetector(
|
||||
focusNode: focusNode,
|
||||
autofocus: false,
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
canRequestFocus: true,
|
||||
focusColor: AppColor.colorMailboxHovered,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
onTap: () => onChanged(!(value)),
|
||||
child: SvgPicture.asset(
|
||||
value ? selectedSvgIconPath : svgIconPath,
|
||||
width: 20,
|
||||
height: 20,
|
||||
colorFilter: AppColor.primaryColor.asFilter(),
|
||||
fit: BoxFit.fill,
|
||||
Widget get buildCheckboxWidget {
|
||||
Widget bodyWidget;
|
||||
|
||||
if (focusNode != null) {
|
||||
bodyWidget = FocusableActionDetector(
|
||||
focusNode: focusNode,
|
||||
autofocus: false,
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
canRequestFocus: true,
|
||||
focusColor: AppColor.colorMailboxHovered,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
onTap: () => onChanged(!(value)),
|
||||
child: SvgPicture.asset(
|
||||
value ? selectedSvgIconPath : svgIconPath,
|
||||
width: 20,
|
||||
height: 20,
|
||||
colorFilter: AppColor.primaryColor.asFilter(),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
} else {
|
||||
bodyWidget = Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
onTap: () => onChanged(!(value)),
|
||||
child: SvgPicture.asset(
|
||||
value ? selectedSvgIconPath : svgIconPath,
|
||||
width: 20,
|
||||
height: 20,
|
||||
colorFilter: AppColor.primaryColor.asFilter(),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (semanticsLabel != null) {
|
||||
return CheckboxSemantics(
|
||||
label: semanticsLabel!,
|
||||
value: value,
|
||||
child: bodyWidget,
|
||||
);
|
||||
} else {
|
||||
return bodyWidget;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ abstract class InputDecorationBuilder {
|
||||
errorTextStyle = newStyle;
|
||||
}
|
||||
|
||||
void setFocusBorder(OutlineInputBorder focusBorder) {
|
||||
focusBorder = focusBorder;
|
||||
void setFocusBorder(OutlineInputBorder newFocusBorder) {
|
||||
focusBorder = newFocusBorder;
|
||||
}
|
||||
|
||||
InputDecoration build() {
|
||||
|
||||
@@ -4,6 +4,8 @@ import 'package:core/utils/direction_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
|
||||
typedef SuggestionBoxDecorationBuilder = Widget Function(Widget child);
|
||||
|
||||
class TypeAheadFormFieldBuilder<T> extends StatefulWidget {
|
||||
|
||||
final TextDirection textDirection;
|
||||
@@ -11,7 +13,7 @@ class TypeAheadFormFieldBuilder<T> extends StatefulWidget {
|
||||
final SuggestionsCallback<T> suggestionsCallback;
|
||||
final ItemBuilder<T> itemBuilder;
|
||||
final SuggestionSelectionCallback<T> onSuggestionSelected;
|
||||
final Widget? suggestionsBoxDecoration;
|
||||
final SuggestionBoxDecorationBuilder? suggestionsBoxDecoration;
|
||||
final WidgetBuilder? noItemsFoundBuilder;
|
||||
final bool hideOnEmpty;
|
||||
final bool hideOnError;
|
||||
@@ -26,6 +28,7 @@ class TypeAheadFormFieldBuilder<T> extends StatefulWidget {
|
||||
final TextInputType keyboardType;
|
||||
final InputDecoration decoration;
|
||||
final Color cursorColor;
|
||||
final TextStyle? textStyle;
|
||||
|
||||
const TypeAheadFormFieldBuilder({
|
||||
super.key,
|
||||
@@ -47,6 +50,7 @@ class TypeAheadFormFieldBuilder<T> extends StatefulWidget {
|
||||
this.cursorColor = AppColor.primaryColor,
|
||||
this.autofillHints,
|
||||
this.textInputAction,
|
||||
this.textStyle,
|
||||
this.onTextChange,
|
||||
this.onTextSubmitted,
|
||||
});
|
||||
@@ -73,13 +77,14 @@ class _TypeAheadFormFieldBuilderState<T> extends State<TypeAheadFormFieldBuilder
|
||||
key: widget.key,
|
||||
controller: widget.controller,
|
||||
focusNode: widget.focusNode,
|
||||
builder: (context, controller, focusNode) {
|
||||
builder: (_, controller, focusNode) {
|
||||
return TextField(
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
textInputAction: widget.textInputAction,
|
||||
autocorrect: widget.autocorrect,
|
||||
autofillHints: widget.autofillHints,
|
||||
style: widget.textStyle,
|
||||
keyboardType: widget.keyboardType,
|
||||
decoration: widget.decoration,
|
||||
textDirection: _textDirection,
|
||||
@@ -103,12 +108,17 @@ class _TypeAheadFormFieldBuilderState<T> extends State<TypeAheadFormFieldBuilder
|
||||
itemBuilder: widget.itemBuilder,
|
||||
onSelected: widget.onSuggestionSelected,
|
||||
decorationBuilder: (context, child) {
|
||||
return widget.suggestionsBoxDecoration ?? Material(
|
||||
type: MaterialType.card,
|
||||
elevation: 4,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
child: child,
|
||||
);
|
||||
if (widget.suggestionsBoxDecoration == null) {
|
||||
return Material(
|
||||
type: MaterialType.card,
|
||||
elevation: 4,
|
||||
color: Colors.white,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
child: child,
|
||||
);
|
||||
} else {
|
||||
return widget.suggestionsBoxDecoration!(child);
|
||||
}
|
||||
},
|
||||
emptyBuilder: widget.noItemsFoundBuilder,
|
||||
hideOnEmpty: widget.hideOnEmpty,
|
||||
|
||||
Reference in New Issue
Block a user