|
|
@@ -0,0 +1,129 @@
|
|
|
+import 'dart:ui';
|
|
|
+
|
|
|
+import 'package:flutter/material.dart';
|
|
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
+import 'package:location/resource/assets.gen.dart';
|
|
|
+import 'package:location/resource/string.gen.dart';
|
|
|
+import 'package:location/utils/common_expand.dart';
|
|
|
+import 'package:location/utils/common_style.dart';
|
|
|
+
|
|
|
+class AddFriendDialog {
|
|
|
+ static final String _tag = 'AddFriendDialog';
|
|
|
+
|
|
|
+ static void show(
|
|
|
+ {required VoidCallback onAddClick,
|
|
|
+ VoidCallback? onCloseClick,
|
|
|
+ VoidCallback? onNotAddDismiss}) {
|
|
|
+ bool isClickAdd = false;
|
|
|
+
|
|
|
+ SmartDialog.show(
|
|
|
+ tag: _tag,
|
|
|
+ onDismiss: () {
|
|
|
+ if (!isClickAdd) {
|
|
|
+ onNotAddDismiss?.call();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ builder: (_) {
|
|
|
+ return AddFriendDialogView(
|
|
|
+ onAddClick: () {
|
|
|
+ isClickAdd = true;
|
|
|
+ onAddClick();
|
|
|
+ },
|
|
|
+ onCloseClick: onCloseClick);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ static void dismiss() {
|
|
|
+ SmartDialog.dismiss(tag: _tag);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class AddFriendDialogView extends Dialog {
|
|
|
+ final VoidCallback onAddClick;
|
|
|
+ final VoidCallback? onCloseClick;
|
|
|
+
|
|
|
+ const AddFriendDialogView({
|
|
|
+ super.key,
|
|
|
+ required this.onAddClick,
|
|
|
+ this.onCloseClick,
|
|
|
+ });
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ return IntrinsicHeight(
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ Center(
|
|
|
+ child: Container(
|
|
|
+ width: 289.w,
|
|
|
+ margin: EdgeInsets.only(top: 34.w),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ borderRadius: BorderRadius.circular(20.w),
|
|
|
+ ),
|
|
|
+ child: IntrinsicHeight(
|
|
|
+ child: Align(
|
|
|
+ alignment: Alignment.topCenter,
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ width: double.infinity,
|
|
|
+ child: Column(children: [
|
|
|
+ SizedBox(height: 89.w),
|
|
|
+ Text(StringName.dialogAddFriendTitle,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 18.sp,
|
|
|
+ color: '#333333'.color,
|
|
|
+ fontWeight: FontWeight.bold)),
|
|
|
+ SizedBox(height: 8.w),
|
|
|
+ Text(StringName.dialogAddFriendTitle,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 15.sp, color: '#404040'.color)),
|
|
|
+ SizedBox(height: 23.w),
|
|
|
+ GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ onAddClick();
|
|
|
+ AddFriendDialog.dismiss();
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ width: 229.w,
|
|
|
+ height: 40.w,
|
|
|
+ decoration: getPrimaryBtnDecoration(32.w),
|
|
|
+ child: Center(
|
|
|
+ child: Text(StringName.dialogAddFriendBtn,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp, color: Colors.white)),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 22.w),
|
|
|
+ ]),
|
|
|
+ ),
|
|
|
+ Align(
|
|
|
+ alignment: Alignment.topRight,
|
|
|
+ child: Container(
|
|
|
+ margin: EdgeInsets.only(top: 12.w, right: 12.w),
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ onCloseClick?.call();
|
|
|
+ AddFriendDialog.dismiss();
|
|
|
+ },
|
|
|
+ child: Assets.images.iconDialogClose
|
|
|
+ .image(width: 20.w, height: 20.w),
|
|
|
+ ),
|
|
|
+ ))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Align(
|
|
|
+ alignment: Alignment.topCenter,
|
|
|
+ child: Assets.images.iconDialogAddFriend.image(width: 124.w)),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|