- 上游: 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>
120 lines
3.1 KiB
Dart
120 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:openim_common/openim_common.dart';
|
|
|
|
class Button extends StatelessWidget {
|
|
const Button({
|
|
Key? key,
|
|
required this.text,
|
|
this.enabled = true,
|
|
this.enabledColor,
|
|
this.disabledColor,
|
|
this.radius,
|
|
this.textStyle,
|
|
this.disabledTextStyle,
|
|
this.onTap,
|
|
this.height,
|
|
this.margin,
|
|
this.padding,
|
|
}) : super(key: key);
|
|
final Color? enabledColor;
|
|
final Color? disabledColor;
|
|
final double? radius;
|
|
final TextStyle? textStyle;
|
|
final TextStyle? disabledTextStyle;
|
|
final String text;
|
|
final double? height;
|
|
final Function()? onTap;
|
|
final EdgeInsetsGeometry? margin;
|
|
final EdgeInsetsGeometry? padding;
|
|
final bool enabled;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: margin,
|
|
child: Material(
|
|
type: MaterialType.transparency,
|
|
child: Ink(
|
|
height: height ?? 44.h,
|
|
decoration: BoxDecoration(
|
|
color: enabled ? enabledColor ?? Styles.c_0089FF : disabledColor ?? Styles.c_0089FF_opacity50,
|
|
borderRadius: BorderRadius.circular(radius ?? 4.r),
|
|
),
|
|
child: InkWell(
|
|
onTap: enabled ? onTap : null,
|
|
borderRadius: BorderRadius.circular(radius ?? 4.r),
|
|
child: Container(
|
|
alignment: Alignment.center,
|
|
padding: padding,
|
|
child: Text(
|
|
text,
|
|
style: textStyle ?? Styles.ts_FFFFFF_17sp_semibold,
|
|
maxLines: 1,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ImageTextButton extends StatelessWidget {
|
|
const ImageTextButton({
|
|
Key? key,
|
|
required this.icon,
|
|
required this.text,
|
|
this.textStyle,
|
|
this.color,
|
|
this.height,
|
|
this.onTap,
|
|
}) : super(key: key);
|
|
final String icon;
|
|
final String text;
|
|
final TextStyle? textStyle;
|
|
final Color? color;
|
|
final double? height;
|
|
final Function()? onTap;
|
|
|
|
ImageTextButton.call({super.key, this.onTap})
|
|
: icon = ImageRes.audioAndVideoCall,
|
|
text = StrRes.audioAndVideoCall,
|
|
color = Styles.c_FFFFFF,
|
|
textStyle = null,
|
|
height = null;
|
|
|
|
ImageTextButton.message({super.key, this.onTap})
|
|
: icon = ImageRes.message,
|
|
text = StrRes.sendMessage,
|
|
color = Styles.c_0089FF,
|
|
textStyle = Styles.ts_FFFFFF_17sp,
|
|
height = null;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
child: Ink(
|
|
height: height ?? 46.h,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(6.r),
|
|
color: color,
|
|
),
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
icon.toImage
|
|
..width = 20.w
|
|
..height = 20.h,
|
|
6.horizontalSpace,
|
|
text.toText..style = textStyle ?? Styles.ts_0C1C33_17sp,
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|