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