Skip to content

Commit

Permalink
[UPDATED] Migrate the example project to null-safety
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-juyoung committed May 17, 2021
1 parent 8c9c0e4 commit 7e38df9
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 45 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.1

* Migrate the example project to null-safety

## 1.0.0

* Migrate to null-safety
Expand Down
81 changes: 41 additions & 40 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class _FitnessApplicationState extends State<FitnessApplication> {
}

void _read({
@required TimeRange timeRange,
required TimeRange timeRange,
int bucketByTime = 1,
TimeUnit timeUnit = TimeUnit.days,
}) async {
Expand Down Expand Up @@ -129,13 +129,13 @@ class _FitnessApplicationState extends State<FitnessApplication> {
),
body: _buildBody(),
floatingActionButton:
_status == PermissionStatus.granted && Platform.isAndroid
? FloatingActionButton(
child: Icon(Icons.link_off),
backgroundColor: Colors.deepOrangeAccent,
onPressed: _revokePermission,
)
: null,
_status == PermissionStatus.granted && Platform.isAndroid
? FloatingActionButton(
child: Icon(Icons.link_off),
backgroundColor: Colors.deepOrangeAccent,
onPressed: _revokePermission,
)
: null,
),
);
}
Expand Down Expand Up @@ -231,40 +231,41 @@ class _FitnessApplicationState extends State<FitnessApplication> {
Expanded(
child: _dataPoints.isNotEmpty
? ListView.separated(
shrinkWrap: true,
itemCount: _dataPoints.length,
itemBuilder: (context, index) {
final dataPoint = _dataPoints[index];
shrinkWrap: true,
itemCount: _dataPoints.length,
itemBuilder: (context, index) {
final dataPoint = _dataPoints[index];

return ListTile(
leading: Image.asset(
'assets/ic_shoes.png',
width: 24.0,
height: 24.0,
),
title: Text('${dataPoint.value} steps'),
subtitle: Text(
'${_format(dataPoint.dateFrom)} - ${_format(dataPoint.dateTo)}',
),
);
},
separatorBuilder: (_, __) {
return SizedBox(height: 16.0);
},
)
: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Lottie.asset(
'assets/walk.json',
width: 100.0,
fit: BoxFit.fill,
),
Text('How about taking a walk for a while?'),
],
return ListTile(
leading: Image.asset(
'assets/ic_shoes.png',
width: 24.0,
height: 24.0,
),
title: Text('${dataPoint.value} steps'),
subtitle: Text(
'${_format(dataPoint.dateFrom)} - ${_format(
dataPoint.dateTo)}',
),
);
},
separatorBuilder: (_, __) {
return SizedBox(height: 16.0);
},
)
: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Lottie.asset(
'assets/walk.json',
width: 100.0,
fit: BoxFit.fill,
),
Text('How about taking a walk for a while?'),
],
),
),
],
),
Expand Down
8 changes: 4 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
sdk: flutter
fitness:
path: ../
intl: ^0.16.1
lottie: ^0.7.0+1
cupertino_icons: ^1.0.0
intl: ^0.17.0
lottie: ^1.0.1
cupertino_icons: ^1.0.3

dev_dependencies:
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: fitness
description: Flutter plugin for reading step count data. Wraps HealthKit on iOS and GoogleFit on Android.
version: 1.0.0
version: 1.0.1
homepage: https://github.com/dev-juyoung/Fitness

environment:
Expand Down

0 comments on commit 7e38df9

Please sign in to comment.