174 lines
5.0 KiB
Dart
174 lines
5.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:yumi/app/config/app_config.dart';
|
|
import 'package:yumi/app_localizations.dart';
|
|
import 'package:yumi/main.dart';
|
|
import 'package:yumi/modules/gift/gift_page.dart';
|
|
import 'package:yumi/services/audio/rtc_manager.dart';
|
|
import 'package:yumi/services/audio/rtm_manager.dart';
|
|
import 'package:yumi/services/auth/user_profile_manager.dart';
|
|
import 'package:yumi/services/general/sc_app_general_manager.dart';
|
|
import 'package:yumi/shared/business_logic/models/res/gift_res.dart';
|
|
import 'package:yumi/shared/data_sources/sources/local/data_persistence.dart';
|
|
|
|
Future<void> main() async {
|
|
AppConfig.initialize();
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await DataPersistence.initialize();
|
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
|
|
runApp(const GiftPagePreviewApp());
|
|
}
|
|
|
|
class GiftPagePreviewApp extends StatelessWidget {
|
|
const GiftPagePreviewApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiProvider(
|
|
providers: [
|
|
ChangeNotifierProvider<SCAppGeneralManager>(
|
|
create: (_) => _PreviewAppGeneralManager(),
|
|
),
|
|
ChangeNotifierProvider<RtcProvider>(create: (_) => RtcProvider()),
|
|
ChangeNotifierProvider<RtmProvider>(create: (_) => RtmProvider()),
|
|
ChangeNotifierProvider<SocialChatUserProfileManager>(
|
|
create: (_) => _PreviewUserProfileManager(),
|
|
),
|
|
],
|
|
child: ScreenUtilInit(
|
|
designSize: const Size(375, 812),
|
|
minTextAdapt: true,
|
|
splitScreenMode: true,
|
|
builder:
|
|
(_, child) => MaterialApp(
|
|
navigatorKey: navigatorKey,
|
|
debugShowCheckedModeBanner: false,
|
|
locale: const Locale('en'),
|
|
supportedLocales: SCAppLocalizations.supportedLocales,
|
|
localizationsDelegates: const [
|
|
SCAppLocalizations.delegate,
|
|
GlobalMaterialLocalizations.delegate,
|
|
GlobalWidgetsLocalizations.delegate,
|
|
GlobalCupertinoLocalizations.delegate,
|
|
],
|
|
builder: FlutterSmartDialog.init(),
|
|
home: const _GiftPagePreviewHome(),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _GiftPagePreviewHome extends StatefulWidget {
|
|
const _GiftPagePreviewHome();
|
|
|
|
@override
|
|
State<_GiftPagePreviewHome> createState() => _GiftPagePreviewHomeState();
|
|
}
|
|
|
|
class _GiftPagePreviewHomeState extends State<_GiftPagePreviewHome> {
|
|
bool _shown = false;
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
super.didChangeDependencies();
|
|
if (_shown) {
|
|
return;
|
|
}
|
|
_shown = true;
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
if (!mounted) {
|
|
return;
|
|
}
|
|
SmartDialog.show(
|
|
tag: "showGiftControl",
|
|
alignment: Alignment.bottomCenter,
|
|
maskColor: Colors.transparent,
|
|
animationType: SmartAnimationType.fade,
|
|
clickMaskDismiss: true,
|
|
builder: (_) => const GiftPage(),
|
|
);
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.black,
|
|
body: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
Image.asset(
|
|
'sc_images/room/sc_icon_room_defaut_bg.png',
|
|
fit: BoxFit.cover,
|
|
errorBuilder:
|
|
(_, __, ___) => const ColoredBox(color: Color(0xFF062320)),
|
|
),
|
|
const Align(
|
|
alignment: Alignment.topCenter,
|
|
child: Padding(
|
|
padding: EdgeInsets.only(top: 88),
|
|
child: Text(
|
|
'Gift panel preview',
|
|
style: TextStyle(color: Colors.white70, fontSize: 16),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _PreviewAppGeneralManager extends SCAppGeneralManager {
|
|
_PreviewAppGeneralManager() {
|
|
final gifts = List<SocialChatGiftRes>.generate(
|
|
8,
|
|
(index) => SocialChatGiftRes(
|
|
id: 'preview_$index',
|
|
giftName: 'Gift ${index + 1}',
|
|
giftCandy: (index + 1) * 10,
|
|
giftTab: 'ALL',
|
|
giftPhoto: '',
|
|
),
|
|
);
|
|
giftResList = gifts;
|
|
giftByTab = {'ALL': gifts};
|
|
}
|
|
|
|
@override
|
|
Future<void> fetchCountryList() async {}
|
|
|
|
@override
|
|
Future<void> giftList({
|
|
bool includeCustomized = true,
|
|
bool forceRefresh = false,
|
|
}) async {}
|
|
|
|
@override
|
|
void giftActivityList() {}
|
|
|
|
@override
|
|
Future<void> giftBackpack({bool forceRefresh = false}) async {}
|
|
|
|
@override
|
|
Future<void> warmGiftPageCovers(
|
|
String type, {
|
|
required int pageIndex,
|
|
int pageCount = 1,
|
|
int pageSize = 8,
|
|
}) async {}
|
|
|
|
@override
|
|
bool isGiftTabLoading(String type) => false;
|
|
}
|
|
|
|
class _PreviewUserProfileManager extends SocialChatUserProfileManager {
|
|
@override
|
|
void balance() {}
|
|
}
|