Skip to content

Commit

Permalink
Merge tag '1.0.0' into develop
Browse files Browse the repository at this point in the history
Tagging version 1.0.0 1.0.0
  • Loading branch information
aaassseee committed Feb 4, 2024
2 parents 69a2e65 + 2e1c7a2 commit 3556e2e
Show file tree
Hide file tree
Showing 27 changed files with 766 additions and 314 deletions.
5 changes: 5 additions & 0 deletions screen_brightness/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.0.0

* updated minimum supported SDK version to Flutter 3.0/Dart 3.0.
* added static instance method

## 0.2.2+1

* updated topics
Expand Down
105 changes: 16 additions & 89 deletions screen_brightness/example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
Expand All @@ -16,104 +15,32 @@
*.iws
.idea/

# Visual Studio Code related
.classpath
.project
.settings/
.vscode/

# Flutter repo-specific
/bin/cache/
/bin/internal/bootstrap.bat
/bin/internal/bootstrap.sh
/bin/mingit/
/dev/benchmarks/mega_gallery/
/dev/bots/.recipe_deps
/dev/bots/android_tools/
/dev/devicelab/ABresults*.json
/dev/docs/doc/
/dev/docs/flutter.docs.zip
/dev/docs/lib/
/dev/docs/pubspec.yaml
/dev/integration_tests/**/xcuserdata
/dev/integration_tests/**/Pods
/packages/flutter/coverage/
version
analysis_benchmark.json

# packages file containing multi-root paths
.packages.generated
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
**/generated_plugin_registrant.dart
.packages
.pub-cache/
.pub/
build/
flutter_*.png
linked_*.ds
unlinked.ds
unlinked_spec.ds

# Android related
**/android/**/gradle-wrapper.jar
.gradle/
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/key.properties
*.jks
/build/

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/.last_build_id
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/ephemeral
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# macOS
**/macos/Flutter/GeneratedPluginRegistrant.swift
**/macos/Flutter/ephemeral
# Web related
lib/generated_plugin_registrant.dart

# Coverage
coverage/

# Symbols
# Symbolication related
app.*.symbols

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
26 changes: 13 additions & 13 deletions screen_brightness/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ class HomePage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
FutureBuilder<double>(
future: ScreenBrightness().current,
future: ScreenBrightness.instance.current,
builder: (context, snapshot) {
double currentBrightness = 0;
if (snapshot.hasData) {
currentBrightness = snapshot.data!;
}

return StreamBuilder<double>(
stream: ScreenBrightness().onCurrentBrightnessChanged,
stream: ScreenBrightness.instance.onCurrentBrightnessChanged,
builder: (context, snapshot) {
double changedBrightness = currentBrightness;
if (snapshot.hasData) {
Expand Down Expand Up @@ -126,7 +126,7 @@ class ControllerPage extends StatefulWidget {
class _ControllerPageState extends State<ControllerPage> {
Future<void> setBrightness(double brightness) async {
try {
await ScreenBrightness().setScreenBrightness(brightness);
await ScreenBrightness.instance.setScreenBrightness(brightness);
} catch (e) {
debugPrint(e.toString());
throw 'Failed to set brightness';
Expand All @@ -135,7 +135,7 @@ class _ControllerPageState extends State<ControllerPage> {

Future<void> resetBrightness() async {
try {
await ScreenBrightness().resetScreenBrightness();
await ScreenBrightness.instance.resetScreenBrightness();
} catch (e) {
debugPrint(e.toString());
throw 'Failed to reset brightness';
Expand All @@ -150,15 +150,15 @@ class _ControllerPageState extends State<ControllerPage> {
),
body: Center(
child: FutureBuilder<double>(
future: ScreenBrightness().current,
future: ScreenBrightness.instance.current,
builder: (context, snapshot) {
double currentBrightness = 0;
if (snapshot.hasData) {
currentBrightness = snapshot.data!;
}

return StreamBuilder<double>(
stream: ScreenBrightness().onCurrentBrightnessChanged,
stream: ScreenBrightness.instance.onCurrentBrightnessChanged,
builder: (context, snapshot) {
double changedBrightness = currentBrightness;
if (snapshot.hasData) {
Expand All @@ -169,7 +169,7 @@ class _ControllerPageState extends State<ControllerPage> {
mainAxisSize: MainAxisSize.min,
children: [
FutureBuilder<bool>(
future: ScreenBrightness().hasChanged,
future: ScreenBrightness.instance.hasChanged,
builder: (context, snapshot) {
return Text(
'Brightness has changed via plugin: ${snapshot.data}');
Expand Down Expand Up @@ -224,25 +224,25 @@ class _RouteAwarePageState extends State<RouteAwarePage> with RouteAware {
@override
void didPush() {
super.didPush();
ScreenBrightness().setScreenBrightness(0.7);
ScreenBrightness.instance.setScreenBrightness(0.7);
}

@override
void didPushNext() {
super.didPushNext();
ScreenBrightness().resetScreenBrightness();
ScreenBrightness.instance.resetScreenBrightness();
}

@override
void didPop() {
super.didPop();
ScreenBrightness().resetScreenBrightness();
ScreenBrightness.instance.resetScreenBrightness();
}

@override
void didPopNext() {
super.didPopNext();
ScreenBrightness().setScreenBrightness(0.7);
ScreenBrightness.instance.setScreenBrightness(0.7);
}

@override
Expand Down Expand Up @@ -295,7 +295,7 @@ class _SettingPageState extends State<SettingPage> {
}

Future<void> getAutoResetSetting() async {
final isAutoReset = await ScreenBrightness().isAutoReset;
final isAutoReset = await ScreenBrightness.instance.isAutoReset;
setState(() {
this.isAutoReset = isAutoReset;
});
Expand All @@ -316,7 +316,7 @@ class _SettingPageState extends State<SettingPage> {
onChanged:
Platform.isIOS || Platform.isWindows || Platform.isMacOS
? (value) async {
await ScreenBrightness().setAutoReset(value);
await ScreenBrightness.instance.setAutoReset(value);
await getAutoResetSetting();
}
: null,
Expand Down
Loading

0 comments on commit 3556e2e

Please sign in to comment.