-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from nini22P/dev
v1.2.0
- Loading branch information
Showing
53 changed files
with
5,067 additions
and
2,389 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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// ignore: unnecessary_library_name | ||
library my_app.globals; | ||
|
||
import 'package:permission_handler/permission_handler.dart'; | ||
|
||
List<String> arguments = []; | ||
String? initUri; | ||
PermissionStatus? storagePermissionStatus; |
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,45 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_hooks/flutter_hooks.dart'; | ||
import 'package:iris/utils/logger.dart'; | ||
import 'package:screen_brightness/screen_brightness.dart'; | ||
|
||
ValueNotifier<double?> useBrightness(bool isGesture) { | ||
final brightness = useState<double?>(null); | ||
|
||
useEffect(() { | ||
try { | ||
() async { | ||
if (!isGesture) return; | ||
brightness.value = await ScreenBrightness().current; | ||
}(); | ||
} catch (e) { | ||
logger('Error getting brightness: $e'); | ||
} | ||
return () => brightness.value = null; | ||
}, [isGesture]); | ||
|
||
useEffect(() { | ||
try { | ||
if (brightness.value != null && isGesture) { | ||
ScreenBrightness().setScreenBrightness(brightness.value!); | ||
} | ||
} catch (e) { | ||
logger('Error setting brightness: $e'); | ||
} | ||
return; | ||
}, [brightness.value]); | ||
|
||
// 退出时重置亮度 | ||
useEffect( | ||
() => () { | ||
try { | ||
ScreenBrightness().resetScreenBrightness(); | ||
} catch (e) { | ||
logger('Error resetting brightness: $e'); | ||
} | ||
}, | ||
[], | ||
); | ||
|
||
return brightness; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_hooks/flutter_hooks.dart'; | ||
import 'package:flutter_volume_controller/flutter_volume_controller.dart'; | ||
import 'package:iris/utils/logger.dart'; | ||
|
||
ValueNotifier<double?> useVolume(bool isGesture) { | ||
final volume = useState<double?>(null); | ||
|
||
useEffect(() { | ||
try { | ||
() async { | ||
if (!isGesture) return; | ||
await FlutterVolumeController.updateShowSystemUI(false); | ||
volume.value = await FlutterVolumeController.getVolume(); | ||
}(); | ||
} catch (e) { | ||
logger('Error getting volume: $e'); | ||
} | ||
return () => volume.value = null; | ||
}, [isGesture]); | ||
|
||
useEffect(() { | ||
try { | ||
if (volume.value != null && isGesture) { | ||
FlutterVolumeController.setVolume(volume.value!); | ||
} | ||
} catch (e) { | ||
logger('Error setting volume: $e'); | ||
} | ||
return; | ||
}, [volume.value]); | ||
|
||
return volume; | ||
} |
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
Oops, something went wrong.