-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): optimize desktop operating experience
Closes #79
- Loading branch information
Showing
7 changed files
with
157 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'dart:ui'; | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
class FrostedGlassButton extends StatelessWidget { | ||
final Widget child; | ||
final double size; | ||
final Function()? onPressed; | ||
|
||
const FrostedGlassButton({super.key, required this.child, required this.size, this.onPressed}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onTap: onPressed, | ||
child: Container( | ||
width: size, | ||
height: size, | ||
clipBehavior: Clip.hardEdge, | ||
decoration: const ShapeDecoration(shape: CircleBorder()), | ||
child: BackdropFilter( | ||
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), | ||
child: Center(child: child), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
import 'image_state.dart'; | ||
|
||
class ImageLogic extends GetxController { | ||
final ImageState state = ImageState(); | ||
late final PageController pageController = PageController(initialPage: state.imageIndex.value); | ||
|
||
@override | ||
void onClose() { | ||
pageController.dispose(); | ||
super.onClose(); | ||
} | ||
|
||
void changePage(int index) { | ||
state.imageIndex = index; | ||
update(); | ||
state.imageIndex.value = index; | ||
} | ||
|
||
//上一张 | ||
void previous() { | ||
if (state.imageIndex.value > 0) { | ||
state.imageIndex.value--; | ||
pageController.animateToPage(state.imageIndex.value, | ||
duration: const Duration(milliseconds: 400), curve: Curves.easeInOut); | ||
} | ||
} | ||
|
||
//下一张 | ||
void next() { | ||
if (state.imageIndex.value < state.imagePathList.length - 1) { | ||
state.imageIndex.value++; | ||
pageController.animateToPage(state.imageIndex.value, | ||
duration: const Duration(milliseconds: 400), curve: Curves.easeInOut); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,10 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
class ImageState { | ||
late List<String> imagePathList; | ||
List<String> imagePathList = Get.arguments[0]; | ||
|
||
//当前图片的的位置 | ||
late int imageIndex; | ||
RxInt imageIndex = (Get.arguments[1] as int).obs; | ||
|
||
//控制器 | ||
late PageController pageController; | ||
|
||
ImageState() { | ||
imagePathList = Get.arguments[0]; | ||
imageIndex = Get.arguments[1]; | ||
pageController = PageController(initialPage: imageIndex); | ||
|
||
///Initialize variables | ||
} | ||
ImageState(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters