TF-390 Apply new ui composer for browser

This commit is contained in:
dab246
2022-03-24 09:08:25 +07:00
committed by Dat H. Pham
parent c2f6434686
commit 8700959362
22 changed files with 820 additions and 494 deletions
@@ -1,4 +1,5 @@
import 'package:core/core.dart';
import 'package:flutter/material.dart';
typedef IconWebCallback = void Function();
@@ -20,7 +21,7 @@ Widget buildIconWeb({
iconSize: iconSize,
padding: iconPadding ?? EdgeInsets.all(8.0),
splashRadius: splashRadius ?? 20,
tooltip: tooltip,
tooltip: tooltip ?? '',
onPressed: onTap)
);
}
@@ -50,4 +51,47 @@ Widget buildIconWebHasPosition(BuildContext context, {
child: icon,
)
);
}
}
Widget buildTextCircleButton(String text, {
TextStyle? textStyle,
IconWebCallback? onTap,
}) {
return Material(
shape: CircleBorder(),
color: Colors.transparent,
child: TextButton(
child: Text(
text,
style: textStyle ?? TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: AppColor.lineItemListColor)),
style: ButtonStyle(
overlayColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) => AppColor.colorFocusButton),
shape: MaterialStateProperty.all(CircleBorder()),
padding: MaterialStateProperty.resolveWith<EdgeInsets>((Set<MaterialState> states) => EdgeInsets.all(5)),
elevation: MaterialStateProperty.resolveWith<double>((Set<MaterialState> states) => 0)),
onPressed: () => onTap?.call()
)
);
}
Widget buildTextButton(String text, {
TextStyle? textStyle,
double? width,
double? height,
Color? backgroundColor,
double? radius,
IconWebCallback? onTap,
}) {
return SizedBox(
width: width ?? double.infinity,
height: height ?? 40,
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((states) => backgroundColor ?? AppColor.colorTextButton),
elevation: MaterialStateProperty.resolveWith((states) => 0),
shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius ?? 0)))),
child: Text(text, style: textStyle ?? TextStyle(fontSize: 17, color: Colors.white, fontWeight: FontWeight.w500)),
onPressed: () => onTap?.call()
),
);
}