feat: update device info plus
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
|
||||||
import '../../../../core/theme/app_theme.dart';
|
import '../../../../core/theme/app_theme.dart';
|
||||||
import '../../../../core/widgets/game_ui.dart';
|
import '../../../../core/widgets/game_ui.dart';
|
||||||
@@ -29,15 +30,32 @@ class LobbyScreen extends StatefulWidget {
|
|||||||
class _LobbyScreenState extends State<LobbyScreen> {
|
class _LobbyScreenState extends State<LobbyScreen> {
|
||||||
final _coinKey = GlobalKey(); // چیپِ سکه (مقصدِ پروازِ سکهها)
|
final _coinKey = GlobalKey(); // چیپِ سکه (مقصدِ پروازِ سکهها)
|
||||||
final _dailyKey = GlobalKey(); // کارتِ هدیهی روزانه (مبدأ)
|
final _dailyKey = GlobalKey(); // کارتِ هدیهی روزانه (مبدأ)
|
||||||
|
String _version = ''; // نسخهی اپ (زیرِ دکمهی خروج)
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
context.read<WalletBloc>().add(LoadWalletEvent());
|
context.read<WalletBloc>().add(LoadWalletEvent());
|
||||||
|
PackageInfo.fromPlatform().then((info) {
|
||||||
|
if (mounted) setState(() => _version = 'نسخه ${info.version}');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _reload() => context.read<WalletBloc>().add(LoadWalletEvent());
|
void _reload() => context.read<WalletBloc>().add(LoadWalletEvent());
|
||||||
|
|
||||||
|
/// خروج از حساب با تأیید در بتمشیت.
|
||||||
|
Future<void> _confirmLogout(BuildContext context) async {
|
||||||
|
final yes = await showModalBottomSheet<bool>(
|
||||||
|
context: context,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
builder: (_) => const _LogoutSheet(),
|
||||||
|
);
|
||||||
|
if (yes == true && context.mounted) {
|
||||||
|
context.read<AuthBloc>().add(LogoutEvent());
|
||||||
|
context.go('/login');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Offset? _center(GlobalKey k) {
|
Offset? _center(GlobalKey k) {
|
||||||
final box = k.currentContext?.findRenderObject() as RenderBox?;
|
final box = k.currentContext?.findRenderObject() as RenderBox?;
|
||||||
if (box == null || !box.attached) return null;
|
if (box == null || !box.attached) return null;
|
||||||
@@ -165,10 +183,7 @@ class _LobbyScreenState extends State<LobbyScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextButton.icon(
|
TextButton.icon(
|
||||||
onPressed: () {
|
onPressed: () => _confirmLogout(context),
|
||||||
context.read<AuthBloc>().add(LogoutEvent());
|
|
||||||
context.go('/login');
|
|
||||||
},
|
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.logout,
|
Icons.logout,
|
||||||
color: Colors.white38,
|
color: Colors.white38,
|
||||||
@@ -179,6 +194,17 @@ class _LobbyScreenState extends State<LobbyScreen> {
|
|||||||
style: TextStyle(color: Colors.white38, fontSize: 13),
|
style: TextStyle(color: Colors.white38, fontSize: 13),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (_version.isNotEmpty)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 8),
|
||||||
|
child: Text(
|
||||||
|
_version,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white24,
|
||||||
|
fontSize: 11,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -451,3 +451,77 @@ class _VipTag extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// بتمشیتِ تأییدِ خروج از حساب (خروج ⇒ true، انصراف ⇒ false).
|
||||||
|
class _LogoutSheet extends StatelessWidget {
|
||||||
|
const _LogoutSheet();
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SafeArea(
|
||||||
|
top: false,
|
||||||
|
child: Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: AppColors.bgDark,
|
||||||
|
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||||
|
border: Border(top: BorderSide(color: AppColors.gold, width: 2)),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.fromLTRB(20, 12, 20, 20),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 42,
|
||||||
|
height: 4,
|
||||||
|
margin: const EdgeInsets.only(bottom: 18),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white24,
|
||||||
|
borderRadius: BorderRadius.circular(2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 60,
|
||||||
|
height: 60,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: AppColors.accent.withValues(alpha: 0.15),
|
||||||
|
border: Border.all(color: AppColors.accent),
|
||||||
|
),
|
||||||
|
child:
|
||||||
|
const Icon(Icons.logout, color: AppColors.accent, size: 30),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 14),
|
||||||
|
const Text(
|
||||||
|
'خروج از حساب؟',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
const Text(
|
||||||
|
'برای ورودِ دوباره باید با شمارهات کدِ تأیید بگیری.',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(color: Colors.white54, fontSize: 13),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 22),
|
||||||
|
GameButton(
|
||||||
|
label: 'خروج از حساب',
|
||||||
|
icon: Icons.logout,
|
||||||
|
width: double.infinity,
|
||||||
|
onTap: () => Navigator.pop(context, true),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context, false),
|
||||||
|
child: const Text(
|
||||||
|
'انصراف',
|
||||||
|
style: TextStyle(color: Colors.white70, fontSize: 14),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -536,6 +536,22 @@ packages:
|
|||||||
url: "https://pub.myket.ir"
|
url: "https://pub.myket.ir"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.0.0"
|
version: "8.0.0"
|
||||||
|
package_info_plus:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: package_info_plus
|
||||||
|
sha256: "16eee997588c60225bda0488b6dcfac69280a6b7a3cf02c741895dd370a02968"
|
||||||
|
url: "https://pub.myket.ir"
|
||||||
|
source: hosted
|
||||||
|
version: "8.3.1"
|
||||||
|
package_info_plus_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_platform_interface
|
||||||
|
sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086"
|
||||||
|
url: "https://pub.myket.ir"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.1"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
+2
-1
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.0+1
|
version: 1.0.2+2
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.7.2
|
sdk: ^3.7.2
|
||||||
@@ -47,6 +47,7 @@ dependencies:
|
|||||||
random_avatar: ^0.0.8
|
random_avatar: ^0.0.8
|
||||||
flutter_svg: ^2.3.0 # نمایشِ شخصیتِ آواتارِ svg (و png با Image.network)
|
flutter_svg: ^2.3.0 # نمایشِ شخصیتِ آواتارِ svg (و png با Image.network)
|
||||||
connectivity_plus: ^6.1.0 # تشخیصِ قطعِ اینترنت برای نمایشِ اوورلیِ «اتصال نیست»
|
connectivity_plus: ^6.1.0 # تشخیصِ قطعِ اینترنت برای نمایشِ اوورلیِ «اتصال نیست»
|
||||||
|
package_info_plus: ^8.1.1 # نمایشِ نسخهی اپ در لابی
|
||||||
# خرید درونبرنامهای: هر flavor یکی را استفاده میکند (مایکت/کافهبازار).
|
# خرید درونبرنامهای: هر flavor یکی را استفاده میکند (مایکت/کافهبازار).
|
||||||
myket_iap: ^1.1.11
|
myket_iap: ^1.1.11
|
||||||
flutter_poolakey: ^2.2.0
|
flutter_poolakey: ^2.2.0
|
||||||
|
|||||||
Reference in New Issue
Block a user