Set default DividerTheme

(cherry picked from commit 9be02961277e990f8ded19106532f9c788eb1d7e)
This commit is contained in:
dab246
2023-12-19 18:55:07 +07:00
committed by Dat H. Pham
parent bd4fb500f6
commit ba83b319b8
23 changed files with 494 additions and 591 deletions
@@ -65,7 +65,6 @@ extension AppColor on Color {
static const backgroundCountAttachment = Color(0x681C1C1C);
static const bgStatusResultSearch = Color(0xFFF5F5F7);
static const bgWordSearch = Color(0x3D007AFF);
static const lineItemListColor = Color(0xFFE7E8EC);
static const colorNameEmail = Color(0xFF000000);
static const colorContentEmail = Color(0xFF6D7885);
static const colorTextButton = Color(0xFF007AFF);
@@ -108,7 +107,7 @@ extension AppColor on Color {
static const colorButtonHeaderThread = Color(0x99EBEDF0);
static const colorBorderBodyThread = Color(0x5CB8C1CC);
static const colorBgDesktop = Color(0xFFF6F6F6);
static const colorItemEmailSelectedDesktop = Color(0x0F007AFF);
static const colorItemEmailSelectedDesktop = Color(0xFFDFEEFF);
static const colorAvatar = Color(0xFFDE5E5E);
static const colorFocusButton = Color(0x14818C99);
static const colorBorderEmailAddressInvalid = Color(0xFFFF3347);
@@ -132,18 +131,12 @@ extension AppColor on Color {
static const colorBackgroundSnackBar = Color(0xFF343438);
static const colorBackgroundHeaderListRuleFilter = Color(0xFFFAF7F7);
static const colorBorderListRuleFilter = Color(0xFFE7E8EC);
static const colorBackgroundHeaderListForwards = Color(0xFFF8F9FA);
static const colorBorderListForwardsFilter = Color(0xFFE7E8EC);
static const colorBackgroundFieldConditionRulesFilter = Color(0xFFF2F3F5);
static const colorDividerRuleFilter = Color(0xFFE7E8EC);
static const colorIconTextField = Color(0xFFB8C1CC);
static const colorDeletePermanentlyButton = Color(0xffE64646);
static const colorDefaultButton = Color(0xff9AA1AD);
static const colorVacationSettingExplanation = Color(0xFF686E76);
static const colorBackgroundVacationSettingField = Color(0xFFF2F3F5);
static const colorBackgroundNotificationVacationSetting= Color(0xFFFFF5C2);
static const colorDivider = Color(0xFFE7E8EC);
static const colorDividerVertical = Color(0xFF99A2AD);
static const colorCloseButton = Color(0xFF818C99);
static const colorDropShadow = Color(0x0F000000);
static const colorBackgroundKeyboard = Color(0xFFD2D5DC);
@@ -11,6 +11,7 @@ class ThemeUtils {
fontFamily: ConstantsUI.fontApp,
appBarTheme: _appBarTheme,
textTheme: _textTheme,
dividerTheme: _dividerTheme,
visualDensity: VisualDensity.adaptivePlatformDensity,
scrollbarTheme: ScrollbarThemeData(
thickness: MaterialStateProperty.all(2.0),
@@ -36,6 +37,13 @@ class ThemeUtils {
);
}
static DividerThemeData get _dividerTheme {
return const DividerThemeData(
color: AppColor.colorDivider,
space: 0
);
}
static void setSystemLightUIStyle() {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.black,
@@ -1,10 +1,9 @@
import 'package:core/core.dart';
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
typedef IconWebCallback = void Function();
typedef IconWebHasPositionCallback = void Function(RelativeRect);
typedef OnTapIconButtonCallbackAction = void Function();
typedef OnTapDownIconButtonCallbackAction = void Function(TapDownDetails tapDetails);
@@ -51,7 +50,7 @@ Widget buildSVGIconButton({
width: iconSize,
height: iconSize,
fit: BoxFit.fill,
colorFilter: iconColor.asFilter(),
colorFilter: iconColor?.asFilter(),
),
);
@@ -76,46 +75,6 @@ Widget buildSVGIconButton({
);
}
Widget buildIconWebHasPosition(BuildContext context, {
required Widget icon,
String? tooltip,
IconWebHasPositionCallback? onTapDown,
IconWebCallback? onTap,
}) {
return Material(
color: Colors.transparent,
shape: const CircleBorder(),
child: InkWell(
onTapDown: (detail) {
onTapDown?.call(detail.getPosition(context));
},
onTap: () => onTap?.call(),
borderRadius: const BorderRadius.all(Radius.circular(12)),
child: Tooltip(
message: tooltip ?? '',
child: icon,
)
),
);
}
Widget buildTextIcon(String text, {
TextStyle? textStyle,
EdgeInsetsGeometry? padding,
IconWebCallback? onTap,
}) {
return Material(
shape: const CircleBorder(),
color: Colors.transparent,
child: InkWell(
child: Padding(
padding: padding ?? const EdgeInsets.all(10),
child: Text(text, style: textStyle ?? const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: AppColor.lineItemListColor))),
onTap: () => onTap?.call()
)
);
}
Widget buildTextButton(String text, {
TextStyle? textStyle,
double? width,
@@ -188,72 +147,4 @@ Widget buildButtonWrapText(String name, {
color: Colors.white)),
),
);
}
Widget buildIconWithLowerMenu(
Widget icon,
BuildContext context,
List<PopupMenuEntry> popupMenuItems,
Function(BuildContext context, RelativeRect? position,
List<PopupMenuEntry> popupMenuItems)
openPopUpMenuAction,
) {
return Builder(
builder: (iconContext) {
final screenSize = MediaQuery.of(context).size;
return buildIconWeb(
icon: icon,
onTap: () {
// get size and position of the icon
RenderBox box = iconContext.findRenderObject() as RenderBox;
Offset iconTopLeft = box.localToGlobal(Offset.zero);
final iconSize = box.size;
// calculate the popup position for popup menu action
final popupLeft = iconTopLeft.dx + iconSize.width * 3 / 4;
final popupTop = iconTopLeft.dy + iconSize.height * 4 / 5;
final popupRight = screenSize.width - popupLeft;
final popupBottom = screenSize.height - popupRight;
final position = RelativeRect.fromLTRB(
popupLeft, popupTop, popupRight, popupBottom);
openPopUpMenuAction(context, position, popupMenuItems);
});
},
);
}
Widget buildIconWithUpperMenu(
Widget icon,
BuildContext context,
List<PopupMenuEntry> popupMenuItems,
Function(BuildContext context, RelativeRect? position,
List<PopupMenuEntry> popupMenuItems)
openPopUpMenuAction,
) {
return Builder(
builder: (iconContext) {
final screenSize = MediaQuery.of(context).size;
return buildIconWeb(
icon: icon,
onTap: () {
// get size and position of the icon
RenderBox box = iconContext.findRenderObject() as RenderBox;
Offset iconTopLeft = box.localToGlobal(Offset.zero);
final iconSize = box.size;
// calculate the popup position for popup menu action
final popupLeft = iconTopLeft.dx + iconSize.width * 3 / 4;
final popupTop = iconTopLeft.dy - iconSize.height * 9 / 5;
final popupRight = screenSize.width - popupLeft;
final popupBottom = screenSize.height - popupRight;
final position = RelativeRect.fromLTRB(
popupLeft, popupTop, popupRight, popupBottom);
openPopUpMenuAction(context, position, popupMenuItems);
});
},
);
}
@@ -1,77 +1,68 @@
import 'package:core/core.dart';
import 'package:flutter/foundation.dart';
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/utils/style_utils.dart';
import 'package:core/presentation/views/button/tmail_button_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
typedef OnOpenSearchViewAction = Function();
class SearchBarView extends StatelessWidget {
final OnOpenSearchViewAction? onOpenSearchViewAction;
final ImagePaths _imagePaths;
final double? heightSearchBar;
final EdgeInsets? padding;
final EdgeInsets? margin;
final ImagePaths imagePaths;
final EdgeInsetsGeometry? margin;
final String? hintTextSearch;
final double? maxSizeWidth;
final Widget? rightButton;
final double? radius;
const SearchBarView(this._imagePaths, {Key? key,
this.heightSearchBar,
this.padding,
this.margin,
this.hintTextSearch,
this.maxSizeWidth,
this.rightButton,
this.onOpenSearchViewAction,
this.radius,
const SearchBarView({
Key? key,
required this.imagePaths,
this.margin,
this.hintTextSearch,
this.onOpenSearchViewAction,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
key: const Key('search_bar_widget'),
alignment: Alignment.center,
height: heightSearchBar ?? 40,
width: maxSizeWidth ?? double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(radius ?? 10),
color: AppColor.colorBgSearchBar),
padding: padding ?? EdgeInsets.zero,
margin: margin ?? EdgeInsets.zero,
child: InkWell(
onTap: onOpenSearchViewAction,
mouseCursor: SystemMouseCursors.text,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(width: 8),
buildIconWeb(
minSize: 40,
iconPadding: EdgeInsets.zero,
icon: SvgPicture.asset(
_imagePaths.icSearchBar,
fit: BoxFit.fill
return Padding(
padding: margin ?? EdgeInsets.zero,
child: InkWell(
onTap: onOpenSearchViewAction,
mouseCursor: SystemMouseCursors.text,
splashColor: Colors.transparent,
borderRadius: const BorderRadius.all(Radius.circular(12)),
child: Container(
alignment: Alignment.center,
height: 40,
width: double.infinity,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
color: AppColor.colorBgSearchBar
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TMailButtonWidget.fromIcon(
icon: imagePaths.icSearchBar,
backgroundColor: Colors.transparent,
onTapActionCallback: onOpenSearchViewAction
),
onTap: onOpenSearchViewAction
),
Expanded(
child: Text(
Expanded(
child: Text(
hintTextSearch ?? '',
maxLines: 1,
overflow: CommonTextStyle.defaultTextOverFlow,
softWrap: CommonTextStyle.defaultSoftWrap,
style: const TextStyle(
fontSize: kIsWeb ? 15 : 17,
color: AppColor.colorHintSearchBar)),
),
if(rightButton != null)
rightButton!
]
),
fontSize: 17,
color: AppColor.colorHintSearchBar
)
),
)
]
),
),
),
);
}
}