Skip to content

Commit

Permalink
Merge pull request #18 from mikjk97/master
Browse files Browse the repository at this point in the history
fix pedometer
  • Loading branch information
forseaest authored May 20, 2022
2 parents 86e2340 + 40f549b commit cc51d1d
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 12 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 31

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
3 changes: 3 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.capstone_2022_48">

<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />

<application
android:label="capstone_2022_48"
android:name="${applicationName}"
Expand Down
22 changes: 13 additions & 9 deletions lib/pages/HomeCalendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:capstone_2022_48/model/DataModel.dart';
import 'dart:io';
import 'package:capstone_2022_48/model/DataModel.dart';
import 'package:capstone_2022_48/pages/Diet.dart';
import 'package:pedometer/pedometer.dart';
import 'package:permission_handler/permission_handler.dart';

class HomeCalendar extends StatefulWidget {
const HomeCalendar({Key? key}) : super(key: key);
Expand Down Expand Up @@ -77,15 +79,16 @@ class _HomeCalendarState extends State<HomeCalendar> {
});
}

void initPlatformState() {
_pedestrianStatusStream = Pedometer.pedestrianStatusStream;
_pedestrianStatusStream
.listen(onPedestrianStatusChanged)
.onError(onPedestrianStatusError);

_stepCountStream = Pedometer.stepCountStream;
_stepCountStream.listen(onStepCount).onError(onStepCountError);
void initPlatformState() async {
if (await Permission.activityRecognition.request().isGranted) {
_pedestrianStatusStream = Pedometer.pedestrianStatusStream;
_pedestrianStatusStream
.listen(onPedestrianStatusChanged)
.onError(onPedestrianStatusError);

_stepCountStream = Pedometer.stepCountStream;
_stepCountStream.listen(onStepCount).onError(onStepCountError);
} else {}
if (!mounted) return;
}

Expand Down Expand Up @@ -246,7 +249,8 @@ class _HomeCalendarState extends State<HomeCalendar> {
// child: (_selectedDay == DateTime.now())
// ? TodayDiet()
// : FutureDiet(),
child: ConditionalDiet(Whatday(_selectedDay!)),
child: ConditionalDiet(Whatday(_selectedDay)),
//_sectedDay! 오류나서 _selectedDay로 수정
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/Signin_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class _SignInScreenState extends State<SignInScreen> {
body: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(color: Color.fromARGB(255, 240, 231, 149)),
decoration: BoxDecoration(color: Colors.white),
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.fromLTRB(
Expand Down
37 changes: 36 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ packages:
source: hosted
version: "1.8.1"
path_provider:
dependency: transitive
dependency: "direct main"
description:
name: path_provider
url: "https://pub.dartlang.org"
Expand Down Expand Up @@ -338,6 +338,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "9.2.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.2+1"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.4"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.7.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
platform:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ dependencies:
syncfusion_flutter_gauges: ^20.1.55
firebase_core: ^1.17.0
firebase_auth: ^3.3.18
path_provider: ^2.0.0
permission_handler: ^9.2.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit cc51d1d

Please sign in to comment.