diff --git a/lib/applovin_max/applovin_manage.dart b/lib/applovin_max/applovin_manage.dart deleted file mode 100644 index f6ba542..0000000 --- a/lib/applovin_max/applovin_manage.dart +++ /dev/null @@ -1,130 +0,0 @@ -import 'dart:async'; -import 'dart:io'; -import 'dart:math'; - -import 'package:applovin_max/applovin_max.dart'; -import 'package:wallpaperx/common/utils/log_print.dart'; - -class ApplovinManage { - ApplovinManage._(); - - static final ApplovinManage _instance = ApplovinManage._(); - - factory ApplovinManage() => _instance; - - /// sdkKey - final String applovinKey = 'nEo4OHOhAZuAK9-IARuNaUfW-yDLBayq9FIGZs0L9XMNTByuDV6dsvMEIGnEAkQu-KR8D42QdKRlbniP910xnK'; - - /// 广告单元Id - final String adUnitId1 = Platform.isAndroid ? 'a2ced77c3755055b' : 'a2ced77c3755055b'; - final String adUnitId2 = Platform.isAndroid ? 'a3819ba97232d772' : 'a3819ba97232d772'; - final String adUnitId3 = Platform.isAndroid ? 'bb0bfc77dcfd1fc4' : 'bb0bfc77dcfd1fc4'; - - /// 是否已初始化 - bool isInitialized = false; - - /// 是否是启动屏幕 - bool isSplashScreen = true; - - /// 重试计数 - final _maxExponentialRetryCount = 6; - var _interstitialRetryAttempt = 0; - - /// 倒计时30秒,3个广告单元不重复展示 - // Timer? _timer; - // int _timeCount = 30; - - /// 初始化 - Future initApplovin() async { - MaxConfiguration? configuration = await AppLovinMAX.initialize(applovinKey); - if (configuration != null) { - isInitialized = true; - } - } - - /// 初始化插页广告 - void initializeInterstitialAds({required Function() onGoHomeTap}) { - if (isInitialized) { - AppLovinMAX.setInterstitialListener(InterstitialListener( - onAdLoadedCallback: (ad) async { - LogPrint.d('插页广告加载成功:${ad.adUnitId}'); - if (ad.adUnitId == adUnitId1 && isSplashScreen) { - await showAdIfReady(adUnitId1); - AppLovinMAX.loadInterstitial(adUnitId1); - isSplashScreen = false; - onGoHomeTap(); - } - _interstitialRetryAttempt = 0; - }, - onAdLoadFailedCallback: (adUnitId, error) { - LogPrint.d('插页广告加载失败adUnitId:$adUnitId,code:${error.code},message:${error.message}'); - if (adUnitId == adUnitId1 && isSplashScreen) { - isSplashScreen = false; - onGoHomeTap(); - } - // Applovin建议您以指数级更高的延迟重试,最大延迟可达64秒 - _interstitialRetryAttempt = _interstitialRetryAttempt + 1; - if (_interstitialRetryAttempt > _maxExponentialRetryCount) return; - int retryDelay = pow(2, min(_maxExponentialRetryCount, _interstitialRetryAttempt)).toInt(); - - Future.delayed(Duration(milliseconds: retryDelay * 1000), () { - AppLovinMAX.loadInterstitial(adUnitId); - }); - }, - onAdDisplayedCallback: (ad) { - LogPrint.d('插页广告显示成功:${ad.adUnitId}'); - }, - onAdDisplayFailedCallback: (ad, error) { - LogPrint.d('插页广告显示失败adUnitId:${ad.adUnitId},code:${error.code},message:${error.message}'); - }, - onAdClickedCallback: (ad) {}, - onAdHiddenCallback: (ad) { - LogPrint.d('插页广告隐藏:${ad.adUnitId}'); - AppLovinMAX.loadInterstitial(ad.adUnitId); - }, - )); - - AppLovinMAX.loadInterstitial(adUnitId1); - AppLovinMAX.loadInterstitial(adUnitId2); - AppLovinMAX.loadInterstitial(adUnitId3); - } - } - - /// 显示插页广告,如果准备好 - Future showAdIfReady(String adUnitId) async { - return; - if (!isInitialized) { - return; - } - - bool isReady = (await AppLovinMAX.isInterstitialReady(adUnitId))!; - if (isReady) { - // if (_timeCount == 30) { - // AppLovinMAX.showInterstitial(adUnitId); - // } - AppLovinMAX.showInterstitial(adUnitId); - } else { - AppLovinMAX.loadInterstitial(adUnitId); - } - } - - // /// 开始定时器 - // void _startTimer() { - // _timer = Timer.periodic(const Duration(seconds: 1), (Timer t) { - // if (_timeCount > 0) { - // _timeCount--; - // LogPrint.d('广告间隔倒计时$_timeCount秒'); - // } else { - // _stopTimer(); - // LogPrint.d('广告间隔计时停止'); - // } - // }); - // } - // - // /// 停止定时器 - // void _stopTimer() { - // _timer?.cancel(); - // _timer = null; - // _timeCount = 30; - // } -} \ No newline at end of file diff --git a/lib/common/components/button/base_textbutton.dart b/lib/common/components/button/base_textbutton.dart deleted file mode 100644 index 79b035b..0000000 --- a/lib/common/components/button/base_textbutton.dart +++ /dev/null @@ -1,56 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:wallpaperx/res/themes/app_styles.dart'; - -class BaseTextButton extends StatelessWidget { - final double? width; - final double? height; - final ButtonStyle? buttonStyle; - final Color? bgColor; - final double? radius; - final String? label; - final TextStyle? textStyle; - final Widget? child; - final Function()? onTap; - - const BaseTextButton({ - super.key, - this.label, - this.width, - this.height, - this.buttonStyle, - this.bgColor, - this.radius, - this.textStyle, - this.child, - this.onTap, - }); - - @override - Widget build(BuildContext context) { - return SizedBox( - width: width, - height: height, - child: TextButton( - onPressed: onTap, - style: buttonStyle ?? - baseTextButtonStyle( - bgColor: bgColor, - radius: radius, - ), - child: child ?? - Text( - label ?? '', - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: textStyle ?? - TextStyle( - color: const Color(0xFF333333), - fontSize: 16.sp, - fontWeight: FontWeight.w600, - ), - ), - ), - ); - } -} diff --git a/lib/common/components/dialog/bottomsheet_dialog.dart b/lib/common/components/dialog/bottomsheet_dialog.dart deleted file mode 100644 index 36342e3..0000000 --- a/lib/common/components/dialog/bottomsheet_dialog.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:wallpaperx/common/components/button/base_textbutton.dart'; -import 'package:wallpaperx/common/components/divider_widget.dart'; - -class BottomSheetDialog { - static void show(void Function(int location) function) { - Get.bottomSheet( - Container( - color: Colors.white, - height: 150.h, - child: Column( - children: [ - Expanded( - child: BaseTextButton( - label: 'Home Screen', - onTap: () { - Get.back(); - function(0); - }, - ), - ), - const DividerWidget(), - Expanded( - child: BaseTextButton( - label: 'Lock Screen', - onTap: () { - Get.back(); - function(1); - }, - ), - ), - const DividerWidget(), - Expanded( - child: BaseTextButton( - label: 'Both Screen', - onTap: () { - Get.back(); - function(2); - }, - ), - ), - ], - ), - ), - ); - } -} \ No newline at end of file diff --git a/lib/common/components/dialog/process_dialog.dart b/lib/common/components/dialog/process_dialog.dart deleted file mode 100644 index bc15882..0000000 --- a/lib/common/components/dialog/process_dialog.dart +++ /dev/null @@ -1,94 +0,0 @@ -// Author: fengshengxiong -// Date: 2024/5/9 -// Description: 进度框 - -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:wallpaperx/common/components/view_state_widget.dart'; -import 'package:wallpaperx/common/utils/obj_util.dart'; - -class ProcessDialog extends StatelessWidget { - final double process; - final String processStr; - final Function() cancelOnTap; - final bool showCanCancel; - - const ProcessDialog( - this.process, - this.processStr, { - super.key, - this.showCanCancel = true, - required this.cancelOnTap, - }); - - @override - Widget build(BuildContext context) { - return PopScope( - canPop: false, - child: Center( - child: IntrinsicWidth( - child: Container( - constraints: BoxConstraints( - minWidth: 80.w, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8).r, - ), - child: IntrinsicHeight( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox(height: 10.h), - loadingView( - color: Colors.black, - value: process, - ), - if (ObjUtil.isNotEmptyStr(processStr)) ...[ - SizedBox(height: 10.h), - Expanded( - child: Text( - processStr, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14.sp, - color: Colors.black, - ), - ), - ), - ], - if (!showCanCancel) ...[ - SizedBox(height: 10.h), - ], - if (showCanCancel) ...[ - SizedBox( - height: 40.h, - child: TextButton( - style: TextButton.styleFrom( - padding: EdgeInsets.zero, - backgroundColor: Colors.transparent, - ), - onPressed: cancelOnTap, - child: Text( - 'Cancel', - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight: FontWeight.w500, - ), - ), - ), - ), - ], - ], - ), - ), - ), - ), - ), - ), - ); - } -} diff --git a/lib/common/components/get_bind_widget.dart b/lib/common/components/get_bind_widget.dart deleted file mode 100644 index a1e271e..0000000 --- a/lib/common/components/get_bind_widget.dart +++ /dev/null @@ -1,70 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - -class GetBindWidget extends StatefulWidget { - const GetBindWidget({ - super.key, - this.bind, - this.tag, - this.binds, - this.tags, - required this.child, - }) : assert( - binds == null || tags == null || binds.length == tags.length, - 'The binds and tags arrays length should be equal\n' - 'and the elements in the two arrays correspond one-to-one', - ); - - final GetxController? bind; - final String? tag; - - final List? binds; - final List? tags; - - final Widget child; - - @override - GetBindWidgetState createState() => GetBindWidgetState(); -} - -class GetBindWidgetState extends State { - @override - Widget build(BuildContext context) { - return widget.child; - } - - @override - void dispose() { - _closeGetXController(); - _closeGetXControllers(); - super.dispose(); - } - - ///Close GetxController bound to the current page - void _closeGetXController() { - if (widget.bind == null) { - return; - } - - var key = widget.bind.runtimeType.toString() + (widget.tag ?? ''); - GetInstance().delete(key: key); - } - - ///Batch close GetxController bound to the current page - void _closeGetXControllers() { - if (widget.binds == null) { - return; - } - - for (var i = 0; i < widget.binds!.length; i++) { - var type = widget.binds![i].runtimeType.toString(); - - if (widget.tags == null) { - GetInstance().delete(key: type); - } else { - var key = type + (widget.tags?[i] ?? ''); - GetInstance().delete(key: key); - } - } - } -} diff --git a/lib/common/components/navigation_bar/appbar_base.dart b/lib/common/components/navigation_bar/custom_appbar.dart similarity index 95% rename from lib/common/components/navigation_bar/appbar_base.dart rename to lib/common/components/navigation_bar/custom_appbar.dart index 194cf2a..9246e28 100644 --- a/lib/common/components/navigation_bar/appbar_base.dart +++ b/lib/common/components/navigation_bar/custom_appbar.dart @@ -4,8 +4,8 @@ import 'package:get/get.dart'; import 'package:wallpaperx/generated/assets.dart'; import 'package:wallpaperx/res/themes/app_colors.dart'; -class BaseAppBar extends StatelessWidget implements PreferredSizeWidget { - const BaseAppBar( +class CustomAppbar extends StatelessWidget implements PreferredSizeWidget { + const CustomAppbar( this.title, { super.key, this.backgroundColor, diff --git a/lib/common/components/navigation_bar/nested_bottom_bar.dart b/lib/common/components/navigation_bar/nested_bottom_bar.dart index c0780a4..465ba20 100644 --- a/lib/common/components/navigation_bar/nested_bottom_bar.dart +++ b/lib/common/components/navigation_bar/nested_bottom_bar.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:wallpaperx/applovin_max/applovin_manage.dart'; import 'package:wallpaperx/res/themes/app_colors.dart'; class NestedBottomBar extends StatelessWidget implements PreferredSizeWidget { @@ -48,7 +47,6 @@ class NestedBottomBar extends StatelessWidget implements PreferredSizeWidget { child: InkWell( onTap: onBackTap ?? () { Get.back(); - // ApplovinManage().showAdIfReady(ApplovinManage().adUnitId3); }, child: Icon(Icons.close,color: Colors.white,size: 24.sp), ), diff --git a/lib/common/components/navigation_bar/title_bar_widget.dart b/lib/common/components/navigation_bar/title_bar_widget.dart deleted file mode 100644 index e7e40a2..0000000 --- a/lib/common/components/navigation_bar/title_bar_widget.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:wallpaperx/res/themes/app_sizes.dart'; - -class TitleBarWidget extends StatelessWidget { - const TitleBarWidget( - this.title, { - super.key, - this.fontSize, - this.backGroundColor, - }); - - final String title; - final double? fontSize; - final Color? backGroundColor; - - @override - Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), - color: backGroundColor??Colors.transparent, - child: SizedBox( - height: titleBarHeight, - child: Row( - mainAxisAlignment: MainAxisAlignment. center, - children: [ - Text( - title, - style: TextStyle( - color: Colors.black87, - fontSize: fontSize??32.sp, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/config/app_tracking_transparency_manager.dart b/lib/config/app_tracking_transparency_manager.dart index daa71d7..28be6cc 100644 --- a/lib/config/app_tracking_transparency_manager.dart +++ b/lib/config/app_tracking_transparency_manager.dart @@ -1,7 +1,3 @@ -// Author: fengshengxiong -// Date: 2024/6/26 -// Description: 应用程序跟踪透明度管理器 - import 'dart:async'; import 'dart:io'; diff --git a/lib/page/about/about_view.dart b/lib/page/about/about_view.dart index 25f9cd1..29dce6e 100644 --- a/lib/page/about/about_view.dart +++ b/lib/page/about/about_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:wallpaperx/common/components/navigation_bar/appbar_base.dart'; +import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart'; import 'package:wallpaperx/generated/assets.dart'; import 'package:wallpaperx/page/about/about_controller.dart'; import 'package:wallpaperx/res/values/strings.dart'; @@ -22,7 +22,7 @@ class AboutView extends GetView { alignment: Alignment.topCenter, child: Column( children: [ - BaseAppBar( + CustomAppbar( "About", backgroundColor: Colors.transparent, titleStyle: TextStyle( diff --git a/lib/page/ai_manager/ai_manager_view.dart b/lib/page/ai_manager/ai_manager_view.dart index 8ece118..fffb0e6 100644 --- a/lib/page/ai_manager/ai_manager_view.dart +++ b/lib/page/ai_manager/ai_manager_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:wallpaperx/common/components/navigation_bar/appbar_base.dart'; +import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart'; import 'package:wallpaperx/generated/assets.dart'; import 'package:wallpaperx/res/values/strings.dart'; @@ -23,7 +23,7 @@ class AiManagerView extends GetView { child: Obx( () => Column( children: [ - BaseAppBar( + CustomAppbar( appName, backgroundColor: Colors.transparent, titleStyle: TextStyle( diff --git a/lib/page/category/category_view.dart b/lib/page/category/category_view.dart index fee80d2..4a54c56 100644 --- a/lib/page/category/category_view.dart +++ b/lib/page/category/category_view.dart @@ -3,7 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:wallpaperx/common/components/image_network_widget.dart'; import 'package:wallpaperx/common/components/keep_alive_wrapper.dart'; -import 'package:wallpaperx/common/components/navigation_bar/appbar_base.dart'; +import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart'; import 'package:wallpaperx/entity/image_model.dart'; import 'package:wallpaperx/generated/assets.dart'; import 'package:wallpaperx/page/category/category_controller.dart'; @@ -34,7 +34,7 @@ class CategoryView extends GetView { } Widget _buildCategoryBar(title) { - return BaseAppBar( + return CustomAppbar( title, backgroundColor: Colors.transparent, titleStyle: TextStyle( diff --git a/lib/page/category_item/category_item_view.dart b/lib/page/category_item/category_item_view.dart index 47e5d4f..71cb268 100644 --- a/lib/page/category_item/category_item_view.dart +++ b/lib/page/category_item/category_item_view.dart @@ -4,7 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:get/get.dart'; import 'package:wallpaperx/common/components/image_network_widget.dart'; -import 'package:wallpaperx/common/components/navigation_bar/appbar_base.dart'; +import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart'; import 'package:wallpaperx/entity/image_model.dart'; import 'package:wallpaperx/res/values/strings.dart'; @@ -17,7 +17,7 @@ class CategoryItemView extends GetView { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, - appBar: BaseAppBar( + appBar: CustomAppbar( appName, backgroundColor: Colors.black, titleStyle: TextStyle( diff --git a/lib/page/edit_userinfo/edit_userinfo_view.dart b/lib/page/edit_userinfo/edit_userinfo_view.dart index 38282e4..b41e511 100644 --- a/lib/page/edit_userinfo/edit_userinfo_view.dart +++ b/lib/page/edit_userinfo/edit_userinfo_view.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:wallpaperx/common/components/navigation_bar/appbar_base.dart'; +import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart'; import 'package:wallpaperx/generated/assets.dart'; import 'edit_userinfo_controller.dart'; @@ -26,7 +26,7 @@ class EditUserinfoView extends GetView { builder: (_) => Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - BaseAppBar( + CustomAppbar( controller.title, backgroundColor: Colors.transparent, titleStyle: TextStyle( diff --git a/lib/page/feed_back/feed_back_view.dart b/lib/page/feed_back/feed_back_view.dart index 6aa0c10..8b053d8 100644 --- a/lib/page/feed_back/feed_back_view.dart +++ b/lib/page/feed_back/feed_back_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:wallpaperx/common/components/navigation_bar/appbar_base.dart'; +import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart'; import 'package:wallpaperx/generated/assets.dart'; import 'package:wallpaperx/page/feed_back/feed_back_controller.dart'; @@ -29,7 +29,7 @@ class FeedBackView extends GetView { child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - BaseAppBar( + CustomAppbar( "Feed Back", backgroundColor: Colors.transparent, titleStyle: TextStyle( diff --git a/lib/page/login/login_view.dart b/lib/page/login/login_view.dart index 5f4415a..a697cff 100644 --- a/lib/page/login/login_view.dart +++ b/lib/page/login/login_view.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:wallpaperx/common/components/navigation_bar/appbar_base.dart'; +import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart'; import 'package:wallpaperx/generated/assets.dart'; import 'package:wallpaperx/page/login/login_controller.dart'; @@ -23,7 +23,7 @@ class LoginView extends GetView { id: "loginInfo", builder: (_) => Column( children: [ - BaseAppBar( + CustomAppbar( "Login", backgroundColor: Colors.transparent, titleStyle: TextStyle( diff --git a/lib/page/wallpaper_detail/wallpaper_detail_controller.dart b/lib/page/wallpaper_detail/wallpaper_detail_controller.dart index dd01ba1..3648979 100644 --- a/lib/page/wallpaper_detail/wallpaper_detail_controller.dart +++ b/lib/page/wallpaper_detail/wallpaper_detail_controller.dart @@ -6,15 +6,12 @@ import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:permission_handler/permission_handler.dart'; -import 'package:wallpaperx/common/components/dialog/bottomsheet_dialog.dart'; import 'package:wallpaperx/common/components/easy_loading.dart'; import 'package:wallpaperx/common/storage/favorite_data.dart'; import 'package:wallpaperx/common/storage/history_data.dart'; import 'package:wallpaperx/common/utils/download_util.dart'; import 'package:wallpaperx/common/utils/log_print.dart'; -import 'package:wallpaperx/common/utils/obj_util.dart'; import 'package:wallpaperx/common/utils/permission_util.dart'; -import 'package:wallpaperx/common/utils/wallpaper_manage.dart'; import 'package:wallpaperx/entity/generate_info_model.dart'; import 'package:wallpaperx/entity/image_model.dart'; import 'package:wallpaperx/page/browse_history/browse_history_controller.dart'; diff --git a/lib/page/web/web_view.dart b/lib/page/web/web_view.dart index 62516d2..773e0c9 100644 --- a/lib/page/web/web_view.dart +++ b/lib/page/web/web_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:wallpaperx/common/components/navigation_bar/appbar_base.dart'; +import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart'; import 'package:wallpaperx/common/components/view_state_widget.dart'; import 'package:webview_flutter/webview_flutter.dart'; @@ -14,7 +14,7 @@ class WebView extends GetView { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - appBar: BaseAppBar( + appBar: CustomAppbar( controller.title, backgroundColor: Colors.black, titleStyle: TextStyle(