feat(mobile-next): 导入官方 openim-flutter-demo 固定基线 3.8.3-patch.3 并完成双构建
- 上游: github.com/OpenIMSDK/openim-flutter-demo tag 3.8.3-patch.3 commit b3dfdb1e8aaeaaf6f0793e10cadd20d5c184a31f - 并行目录 mobile-next/ 原样导入(含 LICENSE),不覆盖现网 mobile/ - 锁定 Flutter 3.24.5 / Dart 3.5.4 / JDK 17 / Gradle 7.6.3 / AGP 7.3.1 - 实测 Android debug 与 release 构建均成功(见 docs/mobile-next-baseline-import.md) - 本提交可单独回退:git revert 1db1229(重写前) Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:openim_common/openim_common.dart';
|
||||
|
||||
class ChatToolBox extends StatelessWidget {
|
||||
const ChatToolBox({
|
||||
super.key,
|
||||
this.onTapAlbum,
|
||||
this.onTapCall,
|
||||
this.onTapCamera,
|
||||
this.onTapCard,
|
||||
this.onTapFile,
|
||||
this.onTapLocation,
|
||||
this.onTapDirectionalMessage,
|
||||
});
|
||||
final Function()? onTapAlbum;
|
||||
final Function()? onTapCamera;
|
||||
final Function()? onTapCall;
|
||||
final Function()? onTapFile;
|
||||
final Function()? onTapCard;
|
||||
final Function()? onTapLocation;
|
||||
final VoidCallback? onTapDirectionalMessage;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final items = [
|
||||
ToolboxItemInfo(
|
||||
text: StrRes.toolboxAlbum,
|
||||
icon: ImageRes.toolboxAlbum,
|
||||
onTap: () => Permissions.photos(onTapAlbum),
|
||||
),
|
||||
ToolboxItemInfo(
|
||||
text: StrRes.toolboxCamera,
|
||||
icon: ImageRes.toolboxCamera,
|
||||
onTap: () => Permissions.cameraAndMicrophone(onTapCamera),
|
||||
),
|
||||
if (onTapCall != null)
|
||||
ToolboxItemInfo(
|
||||
text: StrRes.toolboxCall,
|
||||
icon: ImageRes.toolboxCall,
|
||||
onTap: () => Permissions.cameraAndMicrophone(onTapCall),
|
||||
),
|
||||
ToolboxItemInfo(
|
||||
text: StrRes.toolboxFile,
|
||||
icon: ImageRes.toolboxFile,
|
||||
onTap: () => Permissions.storage(onTapFile),
|
||||
),
|
||||
ToolboxItemInfo(
|
||||
text: StrRes.toolboxCard,
|
||||
icon: ImageRes.toolboxCard,
|
||||
onTap: onTapCard,
|
||||
),
|
||||
ToolboxItemInfo(
|
||||
text: StrRes.toolboxLocation,
|
||||
icon: ImageRes.toolboxLocation,
|
||||
onTap: () => Permissions.location(onTapLocation),
|
||||
),
|
||||
if (onTapDirectionalMessage != null)
|
||||
ToolboxItemInfo(
|
||||
text: StrRes.toolboxDirectionalMessage,
|
||||
icon: ImageRes.toolboxDirectionalMessage,
|
||||
onTap: onTapDirectionalMessage,
|
||||
),
|
||||
];
|
||||
|
||||
return Container(
|
||||
color: Styles.c_F0F2F6,
|
||||
height: 224.h,
|
||||
child: GridView.builder(
|
||||
itemCount: items.length,
|
||||
padding: EdgeInsets.only(
|
||||
left: 16.w,
|
||||
right: 16.w,
|
||||
top: 6.h,
|
||||
bottom: 6.h,
|
||||
),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
childAspectRatio: 78.w / 105.h,
|
||||
crossAxisSpacing: 10.w,
|
||||
mainAxisSpacing: 2.h,
|
||||
),
|
||||
itemBuilder: (_, index) {
|
||||
final item = items.elementAt(index);
|
||||
return _buildItemView(
|
||||
icon: item.icon,
|
||||
text: item.text,
|
||||
onTap: item.onTap,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildItemView({
|
||||
required String text,
|
||||
required String icon,
|
||||
Function()? onTap,
|
||||
}) =>
|
||||
Column(
|
||||
children: [
|
||||
icon.toImage
|
||||
..width = 58.w
|
||||
..height = 58.h
|
||||
..onTap = onTap,
|
||||
10.verticalSpace,
|
||||
text.toText..style = Styles.ts_0C1C33_12sp,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
class ToolboxItemInfo {
|
||||
String text;
|
||||
String icon;
|
||||
Function()? onTap;
|
||||
|
||||
ToolboxItemInfo({required this.text, required this.icon, this.onTap});
|
||||
}
|
||||
Reference in New Issue
Block a user