feat: 新增订单拨号功能,重构订单页与登录页

This commit is contained in:
andyesfly committed 2026-10-21 11:58:36 +08:00
1 parent 774403785c
commit 411ec8be23
9 files changed
+875 -482

No files matched your search

+9 -1
View File
@@ -1,8 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 访问局域网后端接口(release 包也需要) -->
<uses-permission android:name="android.permission.INTERNET"/>
<application <application
android:label="smart_grid_iot_app_flutter" android:label="smart_grid_iot_app_flutter"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
@@ -41,5 +44,10 @@
<action android:name="android.intent.action.PROCESS_TEXT"/> <action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/> <data android:mimeType="text/plain"/>
</intent> </intent>
<!-- 联系客户:允许查询并调起拨号/电话应用 -->
<intent>
<action android:name="android.intent.action.DIAL"/>
<data android:scheme="tel"/>
</intent>
</queries> </queries>
</manifest> </manifest>
+6
View File
@@ -2,6 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>NSAppTransportSecurity</key>
<dict>
<!-- 后端目前为局域网 HTTP,需允许明文请求 -->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CADisableMinimumFrameDurationOnPhone</key> <key>CADisableMinimumFrameDurationOnPhone</key>
<true/> <true/>
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
+6 -2
View File
@@ -7,9 +7,13 @@
/// 解析顺序见 [resolveBaseUrl]。 /// 解析顺序见 [resolveBaseUrl]。
abstract final class Env { abstract final class Env {
/// 编译期默认地址,作为兜底方案。 /// 编译期默认地址,作为兜底方案。
///
/// 默认值指向当前开发机后端(本机实测 7001 可用)。局域网 IP 变化后,
/// 登录页右上角「服务端设置」可直接改,或启动时用
/// `--dart-define=API_BASE_URL=http://<IP>:7001/api` 覆盖。
static const String apiBaseUrl = String.fromEnvironment( static const String apiBaseUrl = String.fromEnvironment(
'API_BASE_URL', 'API_BASE_URL',
defaultValue: 'http://192.168.3.29:7001/api', defaultValue: 'http://192.168.21.184:7001/api',
); );
static final Uri _default = Uri.parse(apiBaseUrl); static final Uri _default = Uri.parse(apiBaseUrl);
@@ -17,7 +21,7 @@ abstract final class Env {
/// 默认主机,取自 [apiBaseUrl]。 /// 默认主机,取自 [apiBaseUrl]。
static String get defaultHost => _default.host; static String get defaultHost => _default.host;
/// 默认端口,取自 [apiBaseUrl],未显式指定时回落 7007。 /// 默认端口,取自 [apiBaseUrl],未显式指定时回落 7001。
static int get defaultPort => _default.hasPort ? _default.port : 7001; static int get defaultPort => _default.hasPort ? _default.port : 7001;
/// 由 IP + 端口拼接 Base URL;协议与路径沿用 [apiBaseUrl], /// 由 IP + 端口拼接 Base URL;协议与路径沿用 [apiBaseUrl],
+271 -387
View File
@@ -5,6 +5,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import '../../../core/env.dart'; import '../../../core/env.dart';
import '../../../core/network/api_response.dart';
import '../../../core/providers.dart'; import '../../../core/providers.dart';
import '../../../core/theme/app_colors.dart'; import '../../../core/theme/app_colors.dart';
import '../../../core/theme/app_dimens.dart'; import '../../../core/theme/app_dimens.dart';
@@ -20,10 +21,11 @@ import '../application/session_controller.dart';
/// `--dart-define=ENABLE_SERVER_SETTINGS=true` 打开。 /// `--dart-define=ENABLE_SERVER_SETTINGS=true` 打开。
const _serverSettingsEnabled = bool.fromEnvironment('ENABLE_SERVER_SETTINGS'); const _serverSettingsEnabled = bool.fromEnvironment('ENABLE_SERVER_SETTINGS');
/// 登录页,对应源 `pages/login/index.vue`。 /// 登录页:手机号 + 密码。
/// ///
/// **与源的差异(已与用户确认)**:源为「手机号 + 验证码」,后端只支持 /// 后端 `/worker-app/auth/login` 只支持手机号 + 密码(源 uni-app 的
/// 「手机号 + 密码」,故此处改为手机号 + 密码,并新增注册入口。 /// 「手机号 + 验证码」已按后端能力调整)。页面只保留登录必需元素,
/// 注册入口作为次要操作放在卡片底部。
class LoginPage extends ConsumerStatefulWidget { class LoginPage extends ConsumerStatefulWidget {
const LoginPage({super.key}); const LoginPage({super.key});
@@ -35,18 +37,10 @@ class _LoginPageState extends ConsumerState<LoginPage> {
final _phone = TextEditingController(); final _phone = TextEditingController();
final _password = TextEditingController(); final _password = TextEditingController();
bool _agree = false;
bool _obscure = true; bool _obscure = true;
bool _loading = false; bool _loading = false;
String _error = ''; String _error = '';
@override
void initState() {
super.initState();
_phone.addListener(_onChanged);
_password.addListener(_onChanged);
}
@override @override
void dispose() { void dispose() {
_phone.dispose(); _phone.dispose();
@@ -54,18 +48,31 @@ class _LoginPageState extends ConsumerState<LoginPage> {
super.dispose(); super.dispose();
} }
void _onChanged() => setState(() {});
bool get _canLogin =>
_phone.text.length == 11 && _password.text.length >= 6 && _agree;
Future<void> _handleLogin() async { Future<void> _handleLogin() async {
if (!_canLogin) { if (_loading) return;
if (!_agree) _error = '请先阅读并同意服务协议与隐私政策';
setState(() {}); final phone = _phone.text.trim();
final password = _password.text;
// 按钮始终可点,校验失败给出明确提示,避免「点了没反应」。
if (phone.isEmpty) {
setState(() => _error = '请输入手机号');
return;
}
if (phone.length != 11) {
setState(() => _error = '请输入 11 位手机号');
return;
}
if (password.isEmpty) {
setState(() => _error = '请输入密码');
return;
}
if (password.length < 6) {
setState(() => _error = '密码至少 6 位');
return; return;
} }
FocusScope.of(context).unfocus();
setState(() { setState(() {
_loading = true; _loading = true;
_error = ''; _error = '';
@@ -73,13 +80,22 @@ class _LoginPageState extends ConsumerState<LoginPage> {
try { try {
await ref await ref
.read(sessionProvider.notifier) .read(sessionProvider.notifier)
.login(phone: _phone.text.trim(), password: _password.text); .login(phone: phone, password: password);
if (!mounted) return; if (!mounted) return;
context.go('/tabs'); context.go('/tabs');
} on AuthException catch (e) { } on AuthException catch (e) {
// 后端返回的业务错误(如手机号或密码错误)
if (mounted) setState(() => _error = e.message); if (mounted) setState(() => _error = e.message);
} on ApiException catch (e) {
if (!mounted) return;
final base = ref.read(apiBaseUrlProvider);
setState(
() => _error = kDebugMode
? '无法连接服务端:${e.message}\n$base'
: '网络异常,请检查网络后重试',
);
} catch (_) { } catch (_) {
if (mounted) setState(() => _error = '网络异常,请检查服务端地址'); if (mounted) setState(() => _error = '网络异常,请检查网络后重试');
} finally { } finally {
if (mounted) setState(() => _loading = false); if (mounted) setState(() => _loading = false);
} }
@@ -88,53 +104,57 @@ class _LoginPageState extends ConsumerState<LoginPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Container( backgroundColor: AppColors.bgPage,
decoration: const BoxDecoration( body: Stack(
gradient: LinearGradient( children: [
begin: Alignment.topCenter, Positioned.fill(
end: Alignment.bottomCenter, child: SafeArea(
colors: [Color(0xFFF0F4FF), Color(0xFFFAF9FE)], child: LayoutBuilder(
), builder: (context, constraints) => SingleChildScrollView(
), padding: const EdgeInsets.fromLTRB(24, 32, 24, 32),
child: Stack( child: ConstrainedBox(
children: [ constraints: BoxConstraints(
Positioned.fill( minHeight: constraints.maxHeight - 64,
child: SingleChildScrollView( ),
padding: const EdgeInsets.fromLTRB(24, 80, 24, 60), child: Center(
child: Column( child: ConstrainedBox(
children: [ constraints: const BoxConstraints(maxWidth: 400),
_buildLogoSection(), child: Column(
_buildFormSection(), mainAxisSize: MainAxisSize.min,
_buildOtherLogin(), crossAxisAlignment: CrossAxisAlignment.stretch,
_buildAgreement(), children: [
const SizedBox(height: 24), _buildBrand(),
_buildRegisterEntry(), const SizedBox(height: 28),
], _buildFormCard(),
), const SizedBox(height: 20),
), _buildAgreementHint(),
), ],
// 测试用「服务端设置」入口:调试版常显,release 需显式开关 ),
if (kDebugMode || _serverSettingsEnabled)
Positioned(
top: 0,
right: 0,
child: SafeArea(
child: GestureDetector(
onTap: _openServerSettings,
behavior: HitTestBehavior.opaque,
child: const Padding(
padding: EdgeInsets.all(12),
child: XIcon(
'settings',
size: 22,
color: AppColors.textMuted,
), ),
), ),
), ),
), ),
), ),
], ),
), ),
// 测试用「服务端设置」入口:调试版常显,release 需显式开关
if (kDebugMode || _serverSettingsEnabled)
Positioned(
top: 0,
right: 0,
child: SafeArea(
child: IconButton(
onPressed: _openServerSettings,
tooltip: '服务端设置',
icon: const XIcon(
'settings',
size: 20,
color: AppColors.textMuted,
),
),
),
),
],
), ),
); );
} }
@@ -151,331 +171,175 @@ class _LoginPageState extends ConsumerState<LoginPage> {
// ---- 各区块 ---- // ---- 各区块 ----
Widget _buildLogoSection() { Widget _buildBrand() {
return Padding( return Column(
padding: const EdgeInsets.only(bottom: 48), children: [
child: Column( Container(
children: [ width: 64,
// .logo 96×96 / #0052ff / radius 20 / 0 8px 24px rgba(0,82,255,.3) height: 64,
Container( decoration: BoxDecoration(
width: 96, color: AppColors.primary,
height: 96, borderRadius: BorderRadius.circular(18),
margin: const EdgeInsets.only(bottom: 24), boxShadow: AppShadows.primaryButton,
decoration: BoxDecoration(
color: AppColors.primary,
borderRadius: BorderRadius.circular(20),
boxShadow: const [
BoxShadow(
color: Color(0x4D0052FF),
blurRadius: 24,
offset: Offset(0, 8),
),
],
),
alignment: Alignment.center,
child: const XIcon('shandian', size: 48, color: Colors.white),
), ),
Padding( alignment: Alignment.center,
padding: const EdgeInsets.only(bottom: 8), child: const XIcon('shandian', size: 34, color: Colors.white),
child: Text( ),
'VoltLink', const SizedBox(height: 16),
style: AppTypography.displayMd.copyWith( Text(
color: AppColors.onSurface, 'VoltLink',
), style: AppTypography.navLargeTitle.copyWith(
), color: AppColors.onSurface,
), ),
const Text( ),
'欢迎回到 VoltLink', const SizedBox(height: 6),
style: TextStyle(fontSize: 16, color: AppColors.textMuted), const Text(
), '电网作业电工端',
], style: TextStyle(fontSize: 14, color: AppColors.textMuted),
), ),
],
); );
} }
Widget _buildFormSection() { Widget _buildFormCard() {
return Padding(
padding: const EdgeInsets.only(bottom: 48),
child: Column(
children: [
// .input-group:白底 / radius 16 / padding 1px
Container(
decoration: BoxDecoration(
color: AppColors.surfaceContainerLowest,
borderRadius: BorderRadius.circular(AppRadius.xl),
),
child: Column(
children: [
_buildPhoneRow(),
_buildPasswordRow(),
],
),
),
const SizedBox(height: 24),
_buildLoginButton(),
if (_error.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 14),
child: Text(
_error,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 13, color: AppColors.error),
),
),
],
),
);
}
/// 手机号行:+86 国家码 + 分隔线 + 输入框。
Widget _buildPhoneRow() {
return Container( return Container(
height: 56, padding: const EdgeInsets.fromLTRB(20, 24, 20, 20),
decoration: const BoxDecoration( decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: AppColors.surfaceContainerHighest)), color: AppColors.surfaceContainerLowest,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: AppColors.borderSoft),
boxShadow: AppShadows.soft,
), ),
child: Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
Padding( Text(
padding: const EdgeInsets.symmetric(horizontal: 20), '登录',
child: Row( style: AppTypography.headlineMd.copyWith(
children: [ color: AppColors.onSurface,
Text(
'+86',
style: AppTypography.bodyLg.copyWith(
fontWeight: FontWeight.w600,
color: AppColors.onSurface,
),
),
const SizedBox(width: 4),
const Text(
'▼',
style: TextStyle(fontSize: 12, color: AppColors.textMuted),
),
],
), ),
), ),
Container(width: 1, height: 32, color: AppColors.surfaceContainerHighest), const SizedBox(height: 4),
Expanded( const Text(
child: TextField( '使用注册手机号和密码登录',
controller: _phone, style: TextStyle(fontSize: 13, color: AppColors.textMuted),
keyboardType: TextInputType.phone, ),
maxLength: 11, const SizedBox(height: 20),
style: const TextStyle(fontSize: 17, color: AppColors.onSurface), _buildLabel('手机号'),
cursorColor: AppColors.primary, const SizedBox(height: 8),
decoration: _inputDecoration('请输入手机号码'), TextField(
controller: _phone,
keyboardType: TextInputType.phone,
textInputAction: TextInputAction.next,
maxLength: 11,
style: const TextStyle(fontSize: 16, color: AppColors.onSurface),
cursorColor: AppColors.primary,
decoration: _fieldDecoration(
hint: '请输入手机号',
icon: Icons.phone_iphone_rounded,
), ),
), ),
const SizedBox(height: 16),
_buildLabel('密码'),
const SizedBox(height: 8),
TextField(
controller: _password,
obscureText: _obscure,
textInputAction: TextInputAction.done,
onSubmitted: (_) => _handleLogin(),
style: const TextStyle(fontSize: 16, color: AppColors.onSurface),
cursorColor: AppColors.primary,
decoration: _fieldDecoration(
hint: '请输入密码(至少 6 位)',
icon: Icons.lock_outline_rounded,
suffix: IconButton(
onPressed: () => setState(() => _obscure = !_obscure),
tooltip: _obscure ? '显示密码' : '隐藏密码',
icon: Icon(
_obscure
? Icons.visibility_off_outlined
: Icons.visibility_outlined,
size: 20,
color: AppColors.textMuted,
),
),
),
),
if (_error.isNotEmpty) ...[
const SizedBox(height: 14),
_buildError(),
],
const SizedBox(height: 20),
XPrimaryButton(
label: '登录',
onPressed: _handleLogin,
loading: _loading,
height: 52,
radius: AppRadius.lg,
shadows: AppShadows.primaryButton,
),
const SizedBox(height: 16),
_buildRegisterEntry(),
], ],
), ),
); );
} }
/// 密码行:源为「验证码 + 获取验证码」,后端改为密码,右侧按钮换成明文切换。 Widget _buildLabel(String text) => Text(
Widget _buildPasswordRow() { text,
return SizedBox( style: AppTypography.bodySm.copyWith(color: AppColors.onSurfaceVariant),
height: 56,
child: Row(
children: [
Expanded(
child: TextField(
controller: _password,
obscureText: _obscure,
style: const TextStyle(fontSize: 17, color: AppColors.onSurface),
cursorColor: AppColors.primary,
decoration: _inputDecoration('请输入密码(至少 6 位)'),
),
),
GestureDetector(
onTap: () => setState(() => _obscure = !_obscure),
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 12,
),
child: Text(
_obscure ? '显示' : '隐藏',
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
color: AppColors.primary,
),
),
),
),
],
),
);
}
InputDecoration _inputDecoration(String hint) => InputDecoration(
isDense: true,
border: InputBorder.none,
counterText: '',
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
hintText: hint,
hintStyle: const TextStyle(fontSize: 17, color: AppColors.textPlaceholder),
); );
Widget _buildLoginButton() { InputDecoration _fieldDecoration({
final enabled = _canLogin && !_loading; required String hint,
return GestureDetector( required IconData icon,
onTap: enabled ? _handleLogin : null, Widget? suffix,
behavior: HitTestBehavior.opaque, }) {
child: AnimatedContainer( final border = OutlineInputBorder(
duration: const Duration(milliseconds: 120), borderRadius: BorderRadius.circular(AppRadius.lg),
height: 56, borderSide: BorderSide.none,
decoration: BoxDecoration( );
color: enabled ? AppColors.primary : AppColors.textPlaceholder, return InputDecoration(
borderRadius: BorderRadius.circular(AppRadius.xl), hintText: hint,
boxShadow: enabled hintStyle: const TextStyle(fontSize: 15, color: AppColors.textPlaceholder),
? const [ prefixIcon: Icon(icon, size: 20, color: AppColors.textMuted),
BoxShadow( prefixIconConstraints: const BoxConstraints(minWidth: 46, minHeight: 46),
color: Color(0x4D0052FF), suffixIcon: suffix,
blurRadius: 20, filled: true,
offset: Offset(0, 8), fillColor: AppColors.surfaceContainerLow,
), counterText: '',
] contentPadding: const EdgeInsets.symmetric(vertical: 16),
: null, border: border,
), enabledBorder: border,
alignment: Alignment.center, focusedBorder: border.copyWith(
child: _loading borderSide: const BorderSide(color: AppColors.primary, width: 1.4),
? const SizedBox(
width: 22,
height: 22,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation(Colors.white),
),
)
: Row(
mainAxisSize: MainAxisSize.min,
children: const [
Text(
'立即登录',
style: TextStyle(
fontSize: 17,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
SizedBox(width: 8),
Text(
'→',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
color: Colors.white,
),
),
],
),
), ),
); );
} }
Widget _buildOtherLogin() { Widget _buildError() {
return Padding( return Container(
padding: const EdgeInsets.only(bottom: 48), padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
child: Column( decoration: BoxDecoration(
children: [ color: AppColors.errorContainer,
const Padding( borderRadius: BorderRadius.circular(AppRadius.regular + 2),
padding: EdgeInsets.only(bottom: 24),
child: Row(
children: [
Expanded(
child: SizedBox(
height: 1,
child: ColoredBox(color: AppColors.surfaceContainerHighest),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
'微信快捷登录',
style: TextStyle(fontSize: 13, color: AppColors.textMuted),
),
),
Expanded(
child: SizedBox(
height: 1,
child: ColoredBox(color: AppColors.surfaceContainerHighest),
),
),
],
),
),
GestureDetector(
onTap: () => showAppToast('微信登录暂未开放'),
behavior: HitTestBehavior.opaque,
child: Container(
width: 56,
height: 56,
decoration: const BoxDecoration(
color: Color(0xFF07C160),
shape: BoxShape.circle,
),
alignment: Alignment.center,
child: const XIcon('weixin', size: 32, color: Colors.white),
),
),
],
), ),
);
}
Widget _buildAgreement() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
GestureDetector( const Icon(
onTap: () => setState(() => _agree = !_agree), Icons.error_outline_rounded,
behavior: HitTestBehavior.opaque, size: 16,
child: Container( color: AppColors.error,
width: 20,
height: 20,
margin: const EdgeInsets.only(top: 1),
decoration: BoxDecoration(
color: _agree ? AppColors.primary : Colors.transparent,
border: Border.all(
color: _agree ? AppColors.primary : AppColors.textPlaceholder,
width: 2,
),
borderRadius: BorderRadius.circular(6),
),
alignment: Alignment.center,
child: _agree
? const Text(
'✓',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.white,
height: 1,
),
)
: null,
),
), ),
const SizedBox(width: 12), const SizedBox(width: 8),
Expanded( Expanded(
child: RichText( child: Text(
text: TextSpan( _error,
style: const TextStyle( style: const TextStyle(
fontSize: 13, fontSize: 13,
height: 1.6, height: 1.4,
color: AppColors.textMuted, color: AppColors.onErrorContainer,
),
children: [
const TextSpan(text: '我已阅读并同意'),
_link('《VoltLink服务协议》'),
const TextSpan(text: '与'),
_link('《隐私政策》'),
const TextSpan(text: ',并授权 VoltLink 在登录时获取我的相关信息。'),
],
), ),
), ),
), ),
@@ -484,39 +348,59 @@ class _LoginPageState extends ConsumerState<LoginPage> {
); );
} }
Widget _buildRegisterEntry() {
return Center(
child: GestureDetector(
onTap: () => context.push('/register'),
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
child: Text.rich(
TextSpan(
style: const TextStyle(fontSize: 14, color: AppColors.textMuted),
children: const [
TextSpan(text: '还没有账号?'),
TextSpan(
text: '立即注册',
style: TextStyle(
fontWeight: FontWeight.w600,
color: AppColors.primary,
),
),
],
),
),
),
),
);
}
/// 极简版不再放协议勾选框:登录即视为同意,文案置底。
Widget _buildAgreementHint() {
return Text.rich(
TextSpan(
style: const TextStyle(
fontSize: 12,
height: 1.6,
color: AppColors.textMuted,
),
children: [
const TextSpan(text: '登录即表示你已阅读并同意'),
_link('《服务协议》'),
const TextSpan(text: '与'),
_link('《隐私政策》'),
],
),
textAlign: TextAlign.center,
);
}
TextSpan _link(String text) => TextSpan( TextSpan _link(String text) => TextSpan(
text: text, text: text,
style: const TextStyle(color: AppColors.primary), style: const TextStyle(color: AppColors.primary),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () => showAppToast('$text 暂未开放'), ..onTap = () => showAppToast('$text 暂未开放'),
); );
Widget _buildRegisterEntry() {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'还没有账号?',
style: TextStyle(fontSize: 14, color: AppColors.textMuted),
),
GestureDetector(
onTap: () => context.push('/register'),
behavior: HitTestBehavior.opaque,
child: const Padding(
padding: EdgeInsets.symmetric(vertical: 6, horizontal: 4),
child: Text(
'立即注册',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: AppColors.primary,
),
),
),
),
],
);
}
} }
/// 调试版「服务端设置」弹窗:只让改 IP 与端口, /// 调试版「服务端设置」弹窗:只让改 IP 与端口,
@@ -618,7 +502,7 @@ class _ServerSettingsSheetState extends ConsumerState<_ServerSettingsSheet> {
_buildField( _buildField(
label: '服务端 IP', label: '服务端 IP',
controller: _host, controller: _host,
hintText: '如 192.168.3.29', hintText: '如 192.168.21.184',
keyboardType: TextInputType.url, keyboardType: TextInputType.url,
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
+28
View File
@@ -66,6 +66,34 @@ class Order {
/// 是否处于「现场勘察中(1)」,仅该状态可维护勘察明细。 /// 是否处于「现场勘察中(1)」,仅该状态可维护勘察明细。
bool get surveyEditable => source == 'survey' && status == 1; bool get surveyEditable => source == 'survey' && status == 1;
/// 是否已完成:报修(2)、安装/维保(1)、勘察已归档(3)。
bool get isCompleted => switch (source) {
'repair' => status == 2,
'install' || 'maintenance' => status == 1,
'survey' => status == 3,
_ => false,
};
/// 当前状态文案,用于「进行中 / 已完成」列表的状态标签。
String get statusText => switch (source) {
'survey' => switch (status) {
0 => '待指派',
1 => '现场勘察中',
2 => '待技术复核',
3 => '已归档',
5 => '已取消',
_ => '进行中',
},
'repair' => switch (status) {
0 => '待处理',
1 => '处理中',
2 => '已完成',
_ => '进行中',
},
'install' || 'maintenance' => status == 1 ? '已完成' : '待上门',
_ => isCompleted ? '已完成' : '进行中',
};
/// 来源中文名,用于收益明细副标题等场景。 /// 来源中文名,用于收益明细副标题等场景。
String get sourceName => switch (source) { String get sourceName => switch (source) {
'repair' => '家庭电路维修', 'repair' => '家庭电路维修',
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../core/network/api_response.dart'; import '../../../core/network/api_response.dart';
import '../../../core/providers.dart'; import '../../../core/providers.dart';
@@ -33,9 +34,14 @@ class OrderDetailPage extends ConsumerWidget {
final String source; final String source;
final int id; final int id;
/// 地图占位暂时隐藏(代码保留,后续接入真实地图时改回 true)。
static const _showMap = false;
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final detail = ref.watch(orderDetailProvider((source: source, id: id))); final detail = ref.watch(orderDetailProvider((source: source, id: id)));
final order = detail.value;
final showBottomAction = order != null && !order.isCompleted;
return Scaffold( return Scaffold(
body: XPageShell( body: XPageShell(
@@ -70,15 +76,16 @@ class OrderDetailPage extends ConsumerWidget {
), ),
}, },
), ),
// 底部固定操作栏,对应源 `.bottom-action` // 已完成订单不再展示出发操作
Positioned( if (showBottomAction)
left: 0, Positioned(
right: 0, left: 0,
bottom: 0, right: 0,
child: _BottomAction( bottom: 0,
onStart: () => showAppToast('已开始出发', success: true), child: _BottomAction(
onStart: () => showAppToast('已开始出发', success: true),
),
), ),
),
], ],
), ),
), ),
@@ -87,11 +94,11 @@ class OrderDetailPage extends ConsumerWidget {
Widget _buildContent(BuildContext context, Order order) { Widget _buildContent(BuildContext context, Order order) {
return SingleChildScrollView( return SingleChildScrollView(
padding: const EdgeInsets.only(bottom: 120), padding: EdgeInsets.only(bottom: order.isCompleted ? 24 : 120),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
_MapSection(address: order.address), if (_showMap) _MapSection(address: order.address),
Padding( Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: Column( child: Column(
@@ -392,7 +399,7 @@ class _CustomerCard extends StatelessWidget {
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
GestureDetector( GestureDetector(
onTap: () => showAppToast('拨打电话'), onTap: () => _callPhone(order.customerPhone),
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: Container( child: Container(
width: 40, width: 40,
@@ -744,6 +751,21 @@ class _DotPatternPainter extends CustomPainter {
bool shouldRepaint(covariant CustomPainter oldDelegate) => false; bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
} }
/// 调起系统拨号盘。
Future<void> _callPhone(String raw) async {
final phone = raw.replaceAll(RegExp(r'[^0-9+]'), '');
if (phone.isEmpty) {
showAppToast('该客户暂无联系方式');
return;
}
try {
final ok = await launchUrl(Uri(scheme: 'tel', path: phone));
if (!ok) showAppToast('无法调起拨号');
} catch (_) {
showAppToast('无法调起拨号');
}
}
/// 打开单张照片大图预览。 /// 打开单张照片大图预览。
void _previewPhoto(BuildContext context, String url) { void _previewPhoto(BuildContext context, String url) {
showDialog<void>( showDialog<void>(
+457 -81
View File
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../core/network/api_response.dart'; import '../../../core/network/api_response.dart';
import '../../../core/providers.dart'; import '../../../core/providers.dart';
@@ -20,10 +21,10 @@ import '../data/order_models.dart';
String _money(num v) => String _money(num v) =>
v == v.roundToDouble() ? v.toStringAsFixed(0) : formatMoney(v); v == v.roundToDouble() ? v.toStringAsFixed(0) : formatMoney(v);
/// 订单 Tab(待接订单),对应源 `pages/order/index.vue`。 /// 订单 Tab:顶部三档切换「进行中 / 待接单 / 已完成」。
/// ///
/// 顶栏与地图区固定,只有下方订单列表滚动;沿用源 `.orders-section` /// 「进行中」「已完成」来自 `myOrders`,待接单来自订单池;地图区域暂时隐藏,
/// 24px 顶部圆角「上移压住地图」的观感(把地图高度相应减 24,视觉等价)。 /// `_showMap` 置 false 保留占位实现,后续接入真实地图时改回 true 即可。
class OrderTab extends ConsumerStatefulWidget { class OrderTab extends ConsumerStatefulWidget {
const OrderTab({super.key}); const OrderTab({super.key});
@@ -32,10 +33,34 @@ class OrderTab extends ConsumerStatefulWidget {
} }
class _OrderTabState extends ConsumerState<OrderTab> { class _OrderTabState extends ConsumerState<OrderTab> {
/// 地图占位暂时隐藏(代码保留)。
static const _showMap = false;
static const _segments = <String>['进行中', '待接单', '已完成'];
/// 待接单的类型筛选,null 表示全部。
static const _typeFilters = <(String?, String)>[
(null, '全部'),
('repair', '报修'),
('install', '安装'),
('maintenance', '维保'),
('survey', '勘察'),
];
/// 0 进行中 / 1 待接单 / 2 已完成。
int _segment = 0;
String? _typeFilter;
/// 本会话内已接单的订单 id(接单后列表会刷新移除,这里用于渲染「已接单」态)。 /// 本会话内已接单的订单 id(接单后列表会刷新移除,这里用于渲染「已接单」态)。
final _grabbed = <String>{}; final _grabbed = <String>{};
String? _grabbing; String? _grabbing;
/// 只订阅当前分段的列表,切换时旧的 autoDispose 实例自动释放。
AsyncValue<List<Order>> _watchActive() => switch (_segment) {
1 => ref.watch(orderPoolProvider),
_ => ref.watch(myOrdersProvider(_segment == 0 ? 'pending' : 'completed')),
};
Future<void> _handleGrab(Order order) async { Future<void> _handleGrab(Order order) async {
if (_grabbing != null || _grabbed.contains(order.id)) return; if (_grabbing != null || _grabbed.contains(order.id)) return;
setState(() => _grabbing = order.id); setState(() => _grabbing = order.id);
@@ -45,9 +70,14 @@ class _OrderTabState extends ConsumerState<OrderTab> {
.grab(order.source, order.intId); .grab(order.source, order.intId);
if (!mounted) return; if (!mounted) return;
if (res.isOk) { if (res.isOk) {
setState(() => _grabbed.add(order.id)); setState(() {
_grabbed.add(order.id);
// 接单成功后订单转入「进行中」,顺手切到该分段,避免用户还要自己找
_segment = 0;
});
showAppToast('接单成功', success: true); showAppToast('接单成功', success: true);
ref.invalidate(orderPoolProvider); ref.invalidate(orderPoolProvider);
ref.invalidate(myOrdersProvider);
} else { } else {
showAppToast(res.message.isEmpty ? '接单失败' : res.message); showAppToast(res.message.isEmpty ? '接单失败' : res.message);
} }
@@ -58,9 +88,41 @@ class _OrderTabState extends ConsumerState<OrderTab> {
} }
} }
Future<void> _refresh() async {
ref.invalidate(orderPoolProvider);
ref.invalidate(myOrdersProvider);
try {
switch (_segment) {
case 1:
await ref.read(orderPoolProvider.future);
case 0:
await ref.read(myOrdersProvider('pending').future);
default:
await ref.read(myOrdersProvider('completed').future);
}
} catch (_) {
// 失败由列表的 hasError 分支展示,这里只负责结束下拉动画
}
}
/// 联系客户:调起系统拨号盘。
Future<void> _callCustomer(Order order) async {
final phone = order.customerPhone.replaceAll(RegExp(r'[^0-9+]'), '');
if (phone.isEmpty) {
showAppToast('该客户暂无联系方式');
return;
}
try {
final ok = await launchUrl(Uri(scheme: 'tel', path: phone));
if (!ok && mounted) showAppToast('无法调起拨号');
} catch (_) {
if (mounted) showAppToast('无法调起拨号');
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final pool = ref.watch(orderPoolProvider); final active = _watchActive();
final unread = ref.watch(noticeUnreadCountProvider); final unread = ref.watch(noticeUnreadCountProvider);
return XPageShell( return XPageShell(
@@ -72,93 +134,176 @@ class _OrderTabState extends ConsumerState<OrderTab> {
trailingBadge: unread, trailingBadge: unread,
onTrailingTap: () => context.push('/notice'), onTrailingTap: () => context.push('/notice'),
), ),
child: RefreshIndicator( child: Column(
color: AppColors.primary, children: [
onRefresh: () async { _buildSegments(),
ref.invalidate(orderPoolProvider); Expanded(
await ref.read(orderPoolProvider.future); child: RefreshIndicator(
}, color: AppColors.primary,
child: ListView( onRefresh: _refresh,
padding: EdgeInsets.zero, child: ListView(
physics: const AlwaysScrollableScrollPhysics(), padding: EdgeInsets.zero,
children: [ physics: const AlwaysScrollableScrollPhysics(),
// 源地图高 320,被下方 24px 圆角区块遮住底部 → 这里直接取 296
SizedBox(height: 296, child: const _MapPlaceholder()),
Container(
decoration: const BoxDecoration(
color: AppColors.bgPage,
borderRadius: BorderRadius.vertical(
top: Radius.circular(AppRadius.xxl),
),
),
padding: const EdgeInsets.fromLTRB(16, 24, 16, 120),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
_buildSectionHeader(pool), // 源地图高 320,被下方 24px 圆角区块遮住底部 → 这里直接取 296
const SizedBox(height: 16), if (_showMap)
..._buildBody(pool), const SizedBox(height: 296, child: _MapPlaceholder()),
Container(
decoration: BoxDecoration(
color: AppColors.bgPage,
borderRadius: _showMap
? const BorderRadius.vertical(
top: Radius.circular(AppRadius.xxl),
)
: BorderRadius.zero,
),
padding: const EdgeInsets.fromLTRB(16, 20, 16, 120),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_buildSectionHeader(active),
if (_segment == 1) ...[
const SizedBox(height: 12),
_buildTypeFilter(),
],
const SizedBox(height: 16),
..._buildBody(active),
],
),
),
], ],
), ),
), ),
),
],
),
);
}
/// 顶部三档分段控件。
Widget _buildSegments() {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 4, 16, 12),
child: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: AppColors.surfaceContainer,
borderRadius: BorderRadius.circular(AppRadius.full),
),
child: Row(
children: [
for (var i = 0; i < _segments.length; i++)
Expanded(
child: GestureDetector(
onTap: () => setState(() => _segment = i),
behavior: HitTestBehavior.opaque,
child: AnimatedContainer(
duration: const Duration(milliseconds: 180),
height: 36,
alignment: Alignment.center,
decoration: BoxDecoration(
color: _segment == i
? AppColors.surfaceContainerLowest
: Colors.transparent,
borderRadius: BorderRadius.circular(AppRadius.full),
boxShadow: _segment == i
? const [
BoxShadow(
color: Color(0x14000000),
blurRadius: 6,
offset: Offset(0, 2),
),
]
: null,
),
child: Text(
_segments[i],
style: TextStyle(
fontSize: 14,
fontWeight: _segment == i
? FontWeight.w700
: FontWeight.w500,
color: _segment == i
? AppColors.onSurface
: AppColors.onSurfaceVariant,
),
),
),
),
),
], ],
), ),
), ),
); );
} }
Widget _buildSectionHeader(AsyncValue<List<Order>> pool) { Widget _buildSectionHeader(AsyncValue<List<Order>> active) {
final count = pool.value?.length; final count = active.value?.length;
return Row( final (title, loadingText, unit) = switch (_segment) {
0 => ('进行中派单', '正在获取进行中的派单…', ' 个进行中'),
1 => ('待接订单', '正在获取附近订单…', ' 个待接订单'),
_ => ('已完成订单', '正在获取已完成订单…', ' 个已完成'),
};
return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Text(
child: Column( title,
crossAxisAlignment: CrossAxisAlignment.start, style: AppTypography.navLargeTitle.copyWith(
children: [ color: AppColors.onSurface,
Text(
'待接订单',
style: AppTypography.navLargeTitle.copyWith(
color: AppColors.onSurface,
),
),
const SizedBox(height: 4),
Text(
count == null ? '正在获取附近订单…' : '附近有 $count 个订单',
style: AppTypography.bodyMd.copyWith(
color: AppColors.onSurfaceVariant,
),
),
],
), ),
), ),
GestureDetector( const SizedBox(height: 4),
onTap: () => showAppToast('筛选功能'), Text(
behavior: HitTestBehavior.opaque, count == null ? loadingText : '共 $count$unit',
child: Padding( style: AppTypography.bodyMd.copyWith(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), color: AppColors.onSurfaceVariant,
child: Row(
children: [
const Text(
'筛选',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
color: AppColors.primary,
),
),
const SizedBox(width: 6),
const XIcon('filter', size: 18, color: AppColors.primary),
],
),
), ),
), ),
], ],
); );
} }
List<Widget> _buildBody(AsyncValue<List<Order>> pool) { /// 待接单的类型筛选。
if (pool.isLoading && !pool.hasValue) { Widget _buildTypeFilter() {
return SizedBox(
height: 34,
child: ListView.separated(
scrollDirection: Axis.horizontal,
itemCount: _typeFilters.length,
separatorBuilder: (_, _) => const SizedBox(width: 8),
itemBuilder: (context, i) {
final (value, label) = _typeFilters[i];
final selected = _typeFilter == value;
return GestureDetector(
onTap: () => setState(() => _typeFilter = value),
behavior: HitTestBehavior.opaque,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 14),
alignment: Alignment.center,
decoration: BoxDecoration(
color: selected
? AppColors.primary
: AppColors.surfaceContainerLow,
borderRadius: BorderRadius.circular(AppRadius.full),
),
child: Text(
label,
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
color: selected ? Colors.white : AppColors.onSurfaceVariant,
),
),
),
);
},
),
);
}
List<Widget> _buildBody(AsyncValue<List<Order>> active) {
if (active.isLoading && !active.hasValue) {
return const [ return const [
Padding( Padding(
padding: EdgeInsets.symmetric(vertical: 60), padding: EdgeInsets.symmetric(vertical: 60),
@@ -175,31 +320,62 @@ class _OrderTabState extends ConsumerState<OrderTab> {
), ),
]; ];
} }
if (pool.hasError && !pool.hasValue) { if (active.hasError && !active.hasValue) {
return [ return [
XPlaceholder(text: '订单加载失败\n${pool.error}'), XPlaceholder(text: '订单加载失败\n${active.error}'),
Center( Center(
child: TextButton( child: TextButton(
onPressed: () => ref.invalidate(orderPoolProvider), onPressed: () {
ref.invalidate(orderPoolProvider);
ref.invalidate(myOrdersProvider);
},
child: const Text('点击重试'), child: const Text('点击重试'),
), ),
), ),
]; ];
} }
final orders = pool.value ?? const <Order>[]; final orders = active.value ?? const <Order>[];
if (_segment == 1) {
final filtered = _typeFilter == null
? orders
: orders.where((o) => o.source == _typeFilter).toList();
if (filtered.isEmpty) {
return [
XPlaceholder(
text: _typeFilter == null ? '附近暂无待接订单' : '该类型暂无待接订单',
),
];
}
return [
for (final order in filtered)
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: _OrderCard(
order: order,
grabbing: _grabbing == order.id,
grabbed: _grabbed.contains(order.id),
onGrab: () => _handleGrab(order),
onTap: () => context.push('/order/${order.source}/${order.intId}'),
),
),
];
}
if (orders.isEmpty) { if (orders.isEmpty) {
return const [XPlaceholder(text: '附近暂无待接订单')]; return [
XPlaceholder(
text: _segment == 0 ? '暂无进行中的派单' : '暂无已完成订单',
),
];
} }
return [ return [
for (final order in orders) for (final order in orders)
Padding( Padding(
padding: const EdgeInsets.only(bottom: 16), padding: const EdgeInsets.only(bottom: 16),
child: _OrderCard( child: _MyOrderCard(
order: order, order: order,
grabbing: _grabbing == order.id, onCall: () => _callCustomer(order),
grabbed: _grabbed.contains(order.id),
onGrab: () => _handleGrab(order),
onTap: () => context.push('/order/${order.source}/${order.intId}'), onTap: () => context.push('/order/${order.source}/${order.intId}'),
), ),
), ),
@@ -410,6 +586,206 @@ class _OrderCard extends StatelessWidget {
); );
} }
/// 进行中 / 已完成订单卡片:状态标签 + 联系客户 + 查看详情。
class _MyOrderCard extends StatelessWidget {
const _MyOrderCard({
required this.order,
required this.onCall,
required this.onTap,
});
final Order order;
final VoidCallback onCall;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return Material(
color: AppColors.surfaceContainerLowest,
borderRadius: BorderRadius.circular(AppRadius.xl),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(AppRadius.xl),
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
border: Border.all(color: AppColors.borderSoft),
borderRadius: BorderRadius.circular(AppRadius.xl),
boxShadow: AppShadows.orderCard,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Row(
children: [
Text(
'#${order.displayNo}',
style: AppTypography.labelCaps.copyWith(
color: AppColors.textMuted,
),
),
const SizedBox(width: 12),
XTypeChip(type: order.type, text: order.listTypeText),
],
),
),
const SizedBox(width: 8),
_statusChip(),
],
),
const SizedBox(height: 12),
Text(
order.title,
style: AppTypography.headlineMd.copyWith(
color: AppColors.onSurface,
),
),
const SizedBox(height: 10),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.only(top: 2),
child: XIcon(
'location',
size: 16,
color: AppColors.onSurfaceVariant,
),
),
const SizedBox(width: 6),
Expanded(
child: Text(
order.address.isEmpty ? '地址待确认' : order.address,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: AppTypography.bodyMd.copyWith(
color: AppColors.onSurfaceVariant,
),
),
),
],
),
const SizedBox(height: 6),
Row(
children: [
const XIcon(
'clock',
size: 16,
color: AppColors.onSurfaceVariant,
),
const SizedBox(width: 6),
Expanded(
child: Text(
order.schedule,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: AppTypography.bodyMd.copyWith(
color: AppColors.onSurfaceVariant,
),
),
),
const SizedBox(width: 12),
Text(
'¥${_money(order.amount)}',
style: AppTypography.bodyLg.copyWith(
fontWeight: FontWeight.w700,
color: AppColors.primary,
),
),
],
),
const SizedBox(height: 16),
Row(
children: [
Expanded(
child: _actionButton(
label: '联系客户',
icon: 'call',
filled: false,
onTap: onCall,
),
),
const SizedBox(width: 12),
Expanded(
child: _actionButton(
label: '查看详情',
icon: 'forward',
filled: true,
onTap: onTap,
),
),
],
),
],
),
),
),
);
}
Widget _statusChip() {
final completed = order.isCompleted;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: completed ? AppColors.surfaceContainer : AppColors.accentSubtle,
borderRadius: BorderRadius.circular(AppRadius.full),
),
child: Text(
order.statusText,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: completed ? AppColors.onSurfaceVariant : AppColors.primary,
),
),
);
}
Widget _actionButton({
required String label,
required String icon,
required bool filled,
required VoidCallback onTap,
}) {
final foreground = filled ? Colors.white : AppColors.onSurface;
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Container(
height: 46,
alignment: Alignment.center,
decoration: BoxDecoration(
color: filled ? AppColors.primary : AppColors.surfaceContainerLow,
borderRadius: BorderRadius.circular(AppRadius.lg),
border: filled
? null
: Border.all(color: const Color(0x80C3C5D9)),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
XIcon(icon, size: 18, color: foreground),
const SizedBox(width: 8),
Text(
label,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: foreground,
),
),
],
),
),
);
}
}
/// 接单中的旋转刷新图标。 /// 接单中的旋转刷新图标。
class _SpinningRefresh extends StatefulWidget { class _SpinningRefresh extends StatefulWidget {
const _SpinningRefresh(); const _SpinningRefresh();
+64
View File
@@ -738,6 +738,70 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.4.0" version: "1.4.0"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8
url: "https://pub.dev"
source: hosted
version: "6.3.2"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "3bb000251e55d4a209aa0e2e563309dc9bb2befea2295fd0cec1f51760aac572"
url: "https://pub.dev"
source: hosted
version: "6.3.29"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "580fe5dfb51671ae38191d316e027f6b76272b026370708c2d898799750a02b0"
url: "https://pub.dev"
source: hosted
version: "6.4.1"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a
url: "https://pub.dev"
source: hosted
version: "3.2.2"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18"
url: "https://pub.dev"
source: hosted
version: "3.2.5"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "85c81589622fbc87c1c683aaea164d3604a7777495a79d91e39ffcdec39ddb34"
url: "https://pub.dev"
source: hosted
version: "2.4.3"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f"
url: "https://pub.dev"
source: hosted
version: "3.1.5"
uuid: uuid:
dependency: transitive dependency: transitive
description: description:
+1
View File
@@ -20,6 +20,7 @@ dependencies:
shared_preferences: ^2.5.5 shared_preferences: ^2.5.5
flutter_svg: ^2.3.0 flutter_svg: ^2.3.0
image_picker: ^1.2.3 image_picker: ^1.2.3
url_launcher: ^6.3.2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: