|
|
@@ -31,136 +31,128 @@ class CustomLabelDialog {
|
|
|
});
|
|
|
SmartDialog.show(
|
|
|
tag: tag,
|
|
|
+ alignment: Alignment.center,
|
|
|
backType: SmartBackType.block,
|
|
|
clickMaskDismiss: true,
|
|
|
maskColor: ColorName.black70,
|
|
|
builder: (_) {
|
|
|
- return Scaffold(
|
|
|
- backgroundColor: Colors.transparent,
|
|
|
- body: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ return Container(
|
|
|
+ width: double.infinity,
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 31.w),
|
|
|
+ decoration: ShapeDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ shape: RoundedRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(20.r),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Stack(
|
|
|
children: [
|
|
|
Container(
|
|
|
- width: double.infinity,
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 31.w),
|
|
|
- decoration: ShapeDecoration(
|
|
|
- color: Colors.white,
|
|
|
- shape: RoundedRectangleBorder(
|
|
|
- borderRadius: BorderRadius.circular(20.r),
|
|
|
- ),
|
|
|
+ padding: EdgeInsets.symmetric(
|
|
|
+ horizontal: 16.w,
|
|
|
+ vertical: 24.h,
|
|
|
),
|
|
|
- child: Stack(
|
|
|
+ child: Column(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
children: [
|
|
|
+ Text(
|
|
|
+ title ?? StringName.customLabel,
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.black.withAlpha(204),
|
|
|
+ fontSize: 16.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 16.h),
|
|
|
Container(
|
|
|
- padding: EdgeInsets.symmetric(
|
|
|
- horizontal: 16.w,
|
|
|
- vertical: 24.h,
|
|
|
+ height: 48.h,
|
|
|
+ alignment: Alignment.center,
|
|
|
+ decoration: ShapeDecoration(
|
|
|
+ color: const Color(0xFFF5F4F9),
|
|
|
+ shape: RoundedRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(31.r),
|
|
|
+ ),
|
|
|
),
|
|
|
- child: Column(
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Text(
|
|
|
- title ?? StringName.customLabel,
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.black.withAlpha(204),
|
|
|
- fontSize: 16.sp,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- ),
|
|
|
+ child: TextField(
|
|
|
+ controller: textController,
|
|
|
+ maxLength: maxLength,
|
|
|
+ maxLines: 1,
|
|
|
+ scrollPhysics: const BouncingScrollPhysics(),
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ textAlignVertical: TextAlignVertical.center,
|
|
|
+ decoration: InputDecoration(
|
|
|
+ isDense: true,
|
|
|
+ counterText: "",
|
|
|
+ hintText: hintText,
|
|
|
+ hintStyle: TextStyle(
|
|
|
+ color: Colors.black.withAlpha(66),
|
|
|
),
|
|
|
- SizedBox(height: 16.h),
|
|
|
- Container(
|
|
|
- height: 48.h,
|
|
|
- alignment: Alignment.center,
|
|
|
- decoration: ShapeDecoration(
|
|
|
- color: const Color(0xFFF5F4F9),
|
|
|
- shape: RoundedRectangleBorder(
|
|
|
- borderRadius: BorderRadius.circular(31.r),
|
|
|
- ),
|
|
|
- ),
|
|
|
- child: TextField(
|
|
|
- controller: textController,
|
|
|
- maxLength: maxLength,
|
|
|
- maxLines: 1,
|
|
|
- scrollPhysics: const BouncingScrollPhysics(),
|
|
|
- textAlign: TextAlign.center,
|
|
|
- textAlignVertical: TextAlignVertical.center,
|
|
|
- decoration: InputDecoration(
|
|
|
- isDense: true,
|
|
|
- counterText: "",
|
|
|
- hintText: hintText,
|
|
|
- hintStyle: TextStyle(
|
|
|
- color: Colors.black.withAlpha(66),
|
|
|
- ),
|
|
|
- border: OutlineInputBorder(
|
|
|
- borderRadius: BorderRadius.circular(10.r),
|
|
|
- borderSide: BorderSide.none, // 移除边框线
|
|
|
- ),
|
|
|
- filled: true,
|
|
|
- fillColor: const Color(0xFFF5F4F9),
|
|
|
- ),
|
|
|
- ),
|
|
|
+ border: OutlineInputBorder(
|
|
|
+ borderRadius: BorderRadius.circular(10.r),
|
|
|
+ borderSide: BorderSide.none, // 移除边框线
|
|
|
),
|
|
|
- SizedBox(height: 24.h),
|
|
|
- Obx(() {
|
|
|
- return Container(
|
|
|
- height: 48.h,
|
|
|
- width: double.infinity,
|
|
|
- decoration:
|
|
|
- isTextEmpty.value
|
|
|
- ? Styles.getInactiveButtonDecoration(
|
|
|
- 31.r,
|
|
|
- )
|
|
|
- : Styles.getActivateButtonDecoration(
|
|
|
- 31.r,
|
|
|
- ),
|
|
|
-
|
|
|
- child: TextButton(
|
|
|
- onPressed: () {
|
|
|
- if (textController.text.isEmpty) {
|
|
|
- return ToastUtil.show(hintText);
|
|
|
- }
|
|
|
- if (textController.text.length > maxLength) {
|
|
|
- return ToastUtil.show(
|
|
|
- '最多$maxLength个字哦~');
|
|
|
- }
|
|
|
-
|
|
|
- clickCallback(textController.text.trim());
|
|
|
- SmartDialog.dismiss();
|
|
|
- },
|
|
|
- child: Text(
|
|
|
- StringName.customLabelSave,
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 16.sp,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
- }),
|
|
|
- ],
|
|
|
+ filled: true,
|
|
|
+ fillColor: const Color(0xFFF5F4F9),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- Positioned(
|
|
|
- right: 14,
|
|
|
- top: 14,
|
|
|
+ SizedBox(height: 24.h),
|
|
|
+ Obx(() {
|
|
|
+ return Container(
|
|
|
+ height: 48.h,
|
|
|
+ width: double.infinity,
|
|
|
+ decoration:
|
|
|
+ isTextEmpty.value
|
|
|
+ ? Styles.getInactiveButtonDecoration(
|
|
|
+ 31.r,
|
|
|
+ )
|
|
|
+ : Styles.getActivateButtonDecoration(
|
|
|
+ 31.r,
|
|
|
+ ),
|
|
|
+
|
|
|
+ child: TextButton(
|
|
|
+ onPressed: () {
|
|
|
+ if (textController.text.isEmpty) {
|
|
|
+ return ToastUtil.show(hintText);
|
|
|
+ }
|
|
|
+ if (textController.text.length > maxLength) {
|
|
|
+ return ToastUtil.show(
|
|
|
+ '最多$maxLength个字哦~');
|
|
|
+ }
|
|
|
|
|
|
- child: GestureDetector(
|
|
|
- onTap: () {
|
|
|
- SmartDialog.dismiss();
|
|
|
- },
|
|
|
- child: Assets.images.iconCustomDialogClose.image(
|
|
|
- width: 24.w,
|
|
|
- height: 24.h,
|
|
|
+ clickCallback(textController.text.trim());
|
|
|
+ SmartDialog.dismiss();
|
|
|
+ },
|
|
|
+ child: Text(
|
|
|
+ StringName.customLabelSave,
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 16.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- ),
|
|
|
+ );
|
|
|
+ }),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
+ Positioned(
|
|
|
+ right: 14,
|
|
|
+ top: 14,
|
|
|
+
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ SmartDialog.dismiss();
|
|
|
+ },
|
|
|
+ child: Assets.images.iconCustomDialogClose.image(
|
|
|
+ width: 24.w,
|
|
|
+ height: 24.h,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
],
|
|
|
),
|
|
|
);
|