TF-913 Fix button text line break in advanced search view

This commit is contained in:
dab246
2022-09-21 11:52:42 +07:00
committed by Dat H. Pham
parent 7fe899daf5
commit d0ff07edfb
7 changed files with 182 additions and 139 deletions
+1
View File
@@ -75,6 +75,7 @@ export 'presentation/views/quick_search/quick_search_input_form.dart';
export 'presentation/views/toast/toast_position.dart';
export 'presentation/views/toast/tmail_toast.dart';
export 'presentation/views/bottom_popup/full_screen_action_sheet_builder.dart';
export 'presentation/views/checkbox/labeled_checkbox.dart';
// Resources
export 'presentation/resources/assets_paths.dart';
@@ -146,6 +146,7 @@ extension AppColor on Color {
static const colorDivider = Color(0xFFE7E8EC);
static const colorDividerVertical = Color(0xFF99A2AD);
static const colorCloseButton = Color(0xFF818C99);
static const colorDropShadow = Color(0x0F000000);
static const mapGradientColor = [
[Color(0xFF21D4FD), Color(0xFFB721FF)],
@@ -120,9 +120,15 @@ Widget buildTextButton(String text, {
backgroundColor: MaterialStateProperty.resolveWith((states) => backgroundColor ?? AppColor.colorTextButton),
elevation: MaterialStateProperty.resolveWith((states) => 0),
padding: MaterialStateProperty.resolveWith<EdgeInsets>(
(Set<MaterialState> states) => padding ?? EdgeInsets.zero),
(Set<MaterialState> states) => padding ?? EdgeInsets.symmetric(horizontal: 8)),
shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius ?? 0)))),
child: Text(text, style: textStyle ?? TextStyle(fontSize: 17, color: Colors.white, fontWeight: FontWeight.w500)),
child: Text(
text,
textAlign: TextAlign.center,
style: textStyle ?? TextStyle(
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.w500)),
onPressed: () => onTap?.call()
),
);
@@ -134,13 +140,17 @@ Widget buildButtonWrapText(String name, {
Color? borderColor,
double? radius,
double? height,
double? minWidth,
EdgeInsets? padding,
FocusNode? focusNode,
IconWebCallback? onTap
}) {
return Container(
height: height ?? 40,
padding: padding,
constraints: BoxConstraints(minWidth: minWidth ?? 0),
child: ElevatedButton(
focusNode: focusNode,
onPressed: () => onTap?.call(),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>(
@@ -0,0 +1,60 @@
import 'package:flutter/material.dart';
class LabeledCheckbox extends StatelessWidget {
const LabeledCheckbox({
required this.label,
this.contentPadding,
this.value,
this.onChanged,
this.activeColor,
this.fontSize = 16,
this.gap = 4.0,
this.bold = false,
this.focusNode,
});
final String label;
final EdgeInsets? contentPadding;
final bool? value;
final Function(bool?)? onChanged;
final Color? activeColor;
final double fontSize;
final double gap;
final bool bold;
final FocusNode? focusNode;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () => onChanged?.call(!(value ?? false)),
child: Padding(
padding: contentPadding ?? const EdgeInsets.all(0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Checkbox(
value: value,
activeColor: activeColor,
visualDensity: VisualDensity.compact,
focusNode: focusNode,
onChanged: onChanged,
),
SizedBox(
width: gap,
),
Flexible(
child: Text(
label,
style: TextStyle(
fontSize: fontSize,
fontWeight: bold ? FontWeight.bold : FontWeight.normal,
color: Colors.black
),
),
),
],
),
),
);
}
}