Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making null safe #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class _MyAppState extends State<MyApp> {
initPlatformState() async {
bool keptOn = await Screen.isKeptOn;
double brightness = await Screen.brightness;
setState((){
setState(() {
_isKeptOn = keptOn;
_brightness = brightness;
});
Expand All @@ -33,26 +33,30 @@ class _MyAppState extends State<MyApp> {
home: new Scaffold(
appBar: new AppBar(title: new Text('Screen plugin example')),
body: new Center(
child: new Column(
children: <Widget>[
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text("Screen is kept on ? "),
new Checkbox(value: _isKeptOn, onChanged: (bool b){
Screen.keepOn(b);
setState((){_isKeptOn = b; });
})
]
),
new Text("Brightness :"),
new Slider(value : _brightness, onChanged : (double b){
setState((){_brightness = b;});
Screen.setBrightness(b);
})
]
)
),
child: new Column(children: <Widget>[
new Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
new Text("Screen is kept on ? "),
new Checkbox(
value: _isKeptOn,
onChanged: (bool? b) {
if (b != null) {
Screen.keepOn(b);
setState(() {
_isKeptOn = b;
});
}
})
]),
new Text("Brightness :"),
new Slider(
value: _brightness,
onChanged: (double b) {
setState(() {
_brightness = b;
});
Screen.setBrightness(b);
})
])),
),
);
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: screen
description: A Flutter plugin to manage the device's screen on Android and iOS.
version: 0.0.5
version: 0.0.6
author: Clovis Nicolas <[email protected]>
homepage: https://github.com/clovisnicolas/flutter_screen

environment:
sdk: '>=2.0.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand Down