1
This commit is contained in:
parent
c7384128ef
commit
2975e10bb4
Binary file not shown.
|
Before Width: | Height: | Size: 9.9 KiB |
BIN
assets/images/placeholder.png
Normal file
BIN
assets/images/placeholder.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 916 KiB |
@ -1,5 +1,3 @@
|
|||||||
import 'dart:collection';
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:wallpaperx/common/utils/log_print.dart';
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
|
|
||||||
@ -41,7 +39,6 @@ class Http {
|
|||||||
if (url.isNotEmpty) {
|
if (url.isNotEmpty) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler.next(e);
|
return handler.next(e);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@ -40,10 +40,10 @@ class HttpUtil {
|
|||||||
);
|
);
|
||||||
callback(isBackResponse == false ? response.toString() : response);
|
callback(isBackResponse == false ? response.toString() : response);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
dismiss(dismiss: true);
|
||||||
LogPrint.d("e: $e");
|
LogPrint.d("e: $e");
|
||||||
FirebaseAnalyticsManager.logEvent(e.toString());
|
FirebaseAnalyticsManager.logEvent(e.toString());
|
||||||
showError("Server error");
|
showError("Server error");
|
||||||
dismiss(dismiss: true);
|
|
||||||
errorCallback!(e);
|
errorCallback!(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class Assets {
|
|||||||
static const String backIcon = 'assets/images/back_icon.png';
|
static const String backIcon = 'assets/images/back_icon.png';
|
||||||
static const String settingBackground = 'assets/images/setting_background.png';
|
static const String settingBackground = 'assets/images/setting_background.png';
|
||||||
static const String selectedIcon = 'assets/images/selected_icon.png';
|
static const String selectedIcon = 'assets/images/selected_icon.png';
|
||||||
static const String placeholder = 'assets/images/placeholder.jpg';
|
static const String placeholder = 'assets/images/placeholder.png';
|
||||||
static const String genieAiBackground1 = 'assets/images/genie_ai_background1.png';
|
static const String genieAiBackground1 = 'assets/images/genie_ai_background1.png';
|
||||||
static const String genieAiBackground2 = 'assets/images/genie_ai_background2.png';
|
static const String genieAiBackground2 = 'assets/images/genie_ai_background2.png';
|
||||||
static const String icCfgScale = 'assets/images/ic_cfg_scale.png';
|
static const String icCfgScale = 'assets/images/ic_cfg_scale.png';
|
||||||
|
|||||||
@ -16,17 +16,27 @@ class AboutView extends GetView<AboutController> {
|
|||||||
appBar: BaseAppBar(
|
appBar: BaseAppBar(
|
||||||
"About",
|
"About",
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
titleStyle: TextStyle(color: Colors.white, fontSize: 24.sp),
|
titleStyle: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 60.h),
|
SizedBox(height: 60.h),
|
||||||
Image.asset(
|
Container(
|
||||||
Assets.iconIconApp,
|
clipBehavior: Clip.hardEdge,
|
||||||
width: 110.w,
|
decoration: BoxDecoration(
|
||||||
height: 110.w,
|
borderRadius: BorderRadius.circular(15.r),
|
||||||
|
),
|
||||||
|
child: Image.asset(
|
||||||
|
Assets.iconIconApp,
|
||||||
|
width: 110.w,
|
||||||
|
height: 110.w,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
|
|||||||
@ -159,9 +159,11 @@ class DiscoverView extends GetView<DiscoverController> {
|
|||||||
tileMode: TileMode.decal,
|
tileMode: TileMode.decal,
|
||||||
),
|
),
|
||||||
child: controller.banners.isEmpty
|
child: controller.banners.isEmpty
|
||||||
? Container()
|
? Image.asset(
|
||||||
|
Assets.homeBackground,
|
||||||
|
)
|
||||||
: PhotoView(
|
: PhotoView(
|
||||||
enableRotation: true,
|
enableRotation: false,
|
||||||
imageProvider: CachedNetworkImageProvider(
|
imageProvider: CachedNetworkImageProvider(
|
||||||
controller.banners[controller.index.value].imageUrl),
|
controller.banners[controller.index.value].imageUrl),
|
||||||
initialScale: PhotoViewComputedScale.covered,
|
initialScale: PhotoViewComputedScale.covered,
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:gradient_borders/box_borders/gradient_box_border.dart';
|
||||||
import 'package:wallpaperx/common/components/image_network_widget.dart';
|
import 'package:wallpaperx/common/components/image_network_widget.dart';
|
||||||
import 'package:wallpaperx/entity/image_model.dart';
|
import 'package:wallpaperx/entity/image_model.dart';
|
||||||
import 'package:wallpaperx/gen/assets.dart';
|
import 'package:wallpaperx/gen/assets.dart';
|
||||||
@ -80,7 +81,12 @@ class SearchView extends GetView<CSearchController> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
height: 40.w,
|
height: 40.w,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
margin: const EdgeInsets.all(16).w,
|
margin: const EdgeInsets.fromLTRB(
|
||||||
|
16,
|
||||||
|
16,
|
||||||
|
0,
|
||||||
|
16,
|
||||||
|
).w,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(50).r,
|
borderRadius: BorderRadius.circular(50).r,
|
||||||
color: const Color(0xff141414),
|
color: const Color(0xff141414),
|
||||||
@ -111,10 +117,12 @@ class SearchView extends GetView<CSearchController> {
|
|||||||
height: 1.4,
|
height: 1.4,
|
||||||
fontSize: 14.sp,
|
fontSize: 14.sp,
|
||||||
color: const Color(0xff47474A)),
|
color: const Color(0xff47474A)),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.fromLTRB(
|
||||||
vertical: -10,
|
-10,
|
||||||
horizontal: -10,
|
-10,
|
||||||
),
|
10,
|
||||||
|
-10,
|
||||||
|
).w,
|
||||||
border: const OutlineInputBorder(
|
border: const OutlineInputBorder(
|
||||||
borderSide: BorderSide.none,
|
borderSide: BorderSide.none,
|
||||||
),
|
),
|
||||||
@ -140,7 +148,9 @@ class SearchView extends GetView<CSearchController> {
|
|||||||
Widget _buildTags(context) {
|
Widget _buildTags(context) {
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(
|
||||||
|
bottom: MediaQuery.of(context).padding.bottom + 10,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(10).r,
|
borderRadius: BorderRadius.circular(10).r,
|
||||||
border: Border.all(color: Colors.black),
|
border: Border.all(color: Colors.black),
|
||||||
@ -152,7 +162,7 @@ class SearchView extends GetView<CSearchController> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(bottom: 12.w),
|
margin: EdgeInsets.only(bottom: 15.w),
|
||||||
child: labelOptionColourItem(
|
child: labelOptionColourItem(
|
||||||
"Anime Characters",
|
"Anime Characters",
|
||||||
Text(
|
Text(
|
||||||
@ -320,24 +330,20 @@ class SearchView extends GetView<CSearchController> {
|
|||||||
child: Transform.rotate(
|
child: Transform.rotate(
|
||||||
angle: angle ?? 0.0 * (math.pi / 180.0),
|
angle: angle ?? 0.0 * (math.pi / 180.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(1),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(50).r,
|
border: const GradientBoxBorder(
|
||||||
gradient: const LinearGradient(
|
gradient: LinearGradient(colors: [
|
||||||
colors: [
|
|
||||||
Color(0xffBEEF32),
|
Color(0xffBEEF32),
|
||||||
Color(0xff2795E5),
|
Color(0xff2795E5),
|
||||||
Color(0xff8041FD),
|
Color(0xff8041FD),
|
||||||
],
|
]),
|
||||||
|
width: 1,
|
||||||
),
|
),
|
||||||
|
borderRadius: BorderRadius.circular(50.r),
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
padding: padding ?? const EdgeInsets.symmetric(vertical: 10).w,
|
padding: padding ?? const EdgeInsets.symmetric(vertical: 10).w,
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(50).r,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
child: tagWidget,
|
child: tagWidget,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -100,9 +100,8 @@ class WallpaperDetController extends GetxController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (canSave) {
|
if (canSave) {
|
||||||
final result = await ImageGallerySaver.saveImage(File(filePath).readAsBytesSync());
|
final result =
|
||||||
LogPrint.d(savePath);
|
await ImageGallerySaver.saveImage(File(filePath).readAsBytesSync());
|
||||||
LogPrint.d(result);
|
|
||||||
if (result['isSuccess']) {
|
if (result['isSuccess']) {
|
||||||
toast('Saved to album');
|
toast('Saved to album');
|
||||||
} else {
|
} else {
|
||||||
@ -124,6 +123,9 @@ class WallpaperDetController extends GetxController {
|
|||||||
FavoriteData().setWallpaperData(imageModel);
|
FavoriteData().setWallpaperData(imageModel);
|
||||||
isFavorite.value = true;
|
isFavorite.value = true;
|
||||||
} else {
|
} else {
|
||||||
|
if (position == FavoriteData().getWallpaperData().length - 1) {
|
||||||
|
position--;
|
||||||
|
}
|
||||||
FavoriteData().delete(index);
|
FavoriteData().delete(index);
|
||||||
isFavorite.value = false;
|
isFavorite.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:flip_card/flip_card.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:gradient_borders/box_borders/gradient_box_border.dart';
|
||||||
import 'package:photo_view/photo_view.dart';
|
import 'package:photo_view/photo_view.dart';
|
||||||
import 'package:photo_view/photo_view_gallery.dart';
|
import 'package:photo_view/photo_view_gallery.dart';
|
||||||
import 'package:wallpaperx/common/components/button/base_textbutton.dart';
|
import 'package:wallpaperx/common/components/button/base_textbutton.dart';
|
||||||
@ -346,23 +347,19 @@ class WallpaperDetView extends GetView<WallpaperDetController> {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => controller.onTapToClsDet(tag),
|
onTap: () => controller.onTapToClsDet(tag),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(1),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(50).r,
|
border: const GradientBoxBorder(
|
||||||
gradient: const LinearGradient(
|
gradient: LinearGradient(colors: [
|
||||||
colors: [
|
|
||||||
Color(0xffBEEF32),
|
Color(0xffBEEF32),
|
||||||
Color(0xff2795E5),
|
Color(0xff2795E5),
|
||||||
Color(0xff8041FD),
|
Color(0xff8041FD),
|
||||||
],
|
]),
|
||||||
|
width: 1,
|
||||||
),
|
),
|
||||||
|
borderRadius: BorderRadius.circular(50.r),
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12).w,
|
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12).w,
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(50).r,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
child: Text(
|
child: Text(
|
||||||
"#$tag",
|
"#$tag",
|
||||||
style: TextStyle(color: Colors.white, fontSize: 14.sp),
|
style: TextStyle(color: Colors.white, fontSize: 14.sp),
|
||||||
|
|||||||
@ -65,15 +65,14 @@ class WallpaperDetV2Controller extends GetxController {
|
|||||||
|
|
||||||
/// 图片切换
|
/// 图片切换
|
||||||
void onPageChanged(int index) {
|
void onPageChanged(int index) {
|
||||||
update(["background"]);
|
|
||||||
position = index;
|
position = index;
|
||||||
filePath = '';
|
filePath = '';
|
||||||
if (isSetHistory) {
|
if (isSetHistory) {
|
||||||
setHistory(position);
|
setHistory(position);
|
||||||
}
|
}
|
||||||
update(["buildImageInfoV2"]);
|
update(["buildImageInfo"]);
|
||||||
int indexOf = FavoriteData().getWallpaperData().indexWhere(
|
int indexOf = FavoriteData().getWallpaperData().indexWhere(
|
||||||
(element) => element.imageUrl == wallpaperList[position].imageUrl);
|
(element) => element.imageUrl == wallpaperList[position].imageUrl);
|
||||||
if (indexOf != -1) {
|
if (indexOf != -1) {
|
||||||
isFavorite.value = true;
|
isFavorite.value = true;
|
||||||
} else {
|
} else {
|
||||||
@ -87,27 +86,24 @@ class WallpaperDetV2Controller extends GetxController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DownloadUtil.downloadFile('${wallpaperList[position].imageUrl}',
|
DownloadUtil.downloadFile('${wallpaperList[position].imageUrl}',
|
||||||
(savePath) async {
|
(savePath) async {
|
||||||
filePath = savePath;
|
filePath = savePath;
|
||||||
bool canSave = true;
|
bool canSave = true;
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isIOS) {
|
||||||
// 在Android 10及以上版本,由于引入了分区存储(Scoped Storage)机制,如果应用只是需要访问媒体文件,而不是整个外部存储
|
canSave = await PermissionUtil.checkPermission(
|
||||||
// ImageGallerySaver使用MediaStore API来添加图片到相册,无需请求存储权限
|
[Permission.photosAddOnly],
|
||||||
// Android 10以下版本,需要申请存储权限
|
);
|
||||||
int sdkVersion = await DeviceInfoUtil.getAndroidSystemVersion();
|
}
|
||||||
if (sdkVersion < 29) {
|
if (canSave) {
|
||||||
canSave = await PermissionUtil.checkPermission([Permission.storage]);
|
final result =
|
||||||
}
|
await ImageGallerySaver.saveImage(File(filePath).readAsBytesSync());
|
||||||
}
|
if (result['isSuccess']) {
|
||||||
if (canSave) {
|
toast('Saved to album');
|
||||||
final result = await ImageGallerySaver.saveFile(savePath);
|
} else {
|
||||||
if (result['isSuccess']) {
|
toast('Unable to save to album');
|
||||||
toast('Saved to album');
|
}
|
||||||
} else {
|
}
|
||||||
toast('Unable to save to album');
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 收藏
|
/// 收藏
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:flip_card/flip_card.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:gradient_borders/box_borders/gradient_box_border.dart';
|
||||||
import 'package:photo_view/photo_view.dart';
|
import 'package:photo_view/photo_view.dart';
|
||||||
import 'package:photo_view/photo_view_gallery.dart';
|
import 'package:photo_view/photo_view_gallery.dart';
|
||||||
import 'package:wallpaperx/common/components/view_state_widget.dart';
|
import 'package:wallpaperx/common/components/view_state_widget.dart';
|
||||||
@ -345,23 +346,19 @@ class WallpaperDetV2View extends GetView<WallpaperDetV2Controller> {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => controller.onTapToClsDet(tag),
|
onTap: () => controller.onTapToClsDet(tag),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(1),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(50).r,
|
border: const GradientBoxBorder(
|
||||||
gradient: const LinearGradient(
|
gradient: LinearGradient(colors: [
|
||||||
colors: [
|
|
||||||
Color(0xffBEEF32),
|
Color(0xffBEEF32),
|
||||||
Color(0xff2795E5),
|
Color(0xff2795E5),
|
||||||
Color(0xff8041FD),
|
Color(0xff8041FD),
|
||||||
],
|
]),
|
||||||
|
width: 1,
|
||||||
),
|
),
|
||||||
|
borderRadius: BorderRadius.circular(50.r),
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12).w,
|
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12).w,
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(50).r,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
child: Text(
|
child: Text(
|
||||||
"#$tag",
|
"#$tag",
|
||||||
style: TextStyle(color: Colors.white, fontSize: 14.sp),
|
style: TextStyle(color: Colors.white, fontSize: 14.sp),
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
const appName = 'Genie AI';
|
const appName = 'Wallpaper Genie';
|
||||||
@ -96,10 +96,10 @@ dependencies:
|
|||||||
# 提示框
|
# 提示框
|
||||||
bot_toast: ^4.1.3
|
bot_toast: ^4.1.3
|
||||||
|
|
||||||
# 动态边框
|
# 翻转卡片
|
||||||
# flutter_colors_border: ^0.0.4
|
|
||||||
flip_card: ^0.7.0
|
flip_card: ^0.7.0
|
||||||
app_tracking_transparency: ^2.0.5
|
app_tracking_transparency: ^2.0.5
|
||||||
|
gradient_borders: ^1.0.1
|
||||||
|
|
||||||
# Firebase
|
# Firebase
|
||||||
firebase_core: ^2.32.0
|
firebase_core: ^2.32.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user