Commit 96e3066a authored by indika N kumara's avatar indika N kumara

Merge branch 'I_GUIDER_PHASE_03_NK' into 'dev_release'

I guider phase 03 nk

See merge request !24
parents d954b699 c68ab827
...@@ -31,7 +31,17 @@ ...@@ -31,7 +31,17 @@
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity> </activity>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
</intent-filter>
</receiver>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data <meta-data
......
import 'package:covidefender/pages/heart_rate/heart_rate_screen.dart'; import 'package:covidefender/pages/heart_rate/heart_rate_screen.dart';
import 'package:covidefender/pages/mask_detect/invoker.dart'; import 'package:covidefender/pages/mask_detect/invoker.dart';
import 'package:covidefender/pages/notificator/ui/MainNotificationUI.dart';
import 'package:covidefender/pages/notificator/ui/notificator.dart';
import 'package:covidefender/pages/self_carer/sc_main_screen.dart'; import 'package:covidefender/pages/self_carer/sc_main_screen.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -51,12 +53,12 @@ class I_guider extends StatelessWidget { ...@@ -51,12 +53,12 @@ class I_guider extends StatelessWidget {
icon: Column( icon: Column(
children: [ children: [
Icon( Icon(
Icons.bluetooth_audio_rounded, Icons.notifications,
size: 40, size: 40,
color: Colors.white, color: Colors.white,
), ),
SizedBox(height: 20), SizedBox(height: 20),
Text("BT Distancer",style:TextStyle( Text("Notificator",style:TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white color: Colors.white
) ,) ) ,)
...@@ -64,7 +66,10 @@ class I_guider extends StatelessWidget { ...@@ -64,7 +66,10 @@ class I_guider extends StatelessWidget {
), ),
label: Text('', label: Text('',
style: TextStyle(fontWeight: FontWeight.bold)), style: TextStyle(fontWeight: FontWeight.bold)),
onPressed: () {}, onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => MainNotificationUI() ));
},
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)), borderRadius: BorderRadius.circular(10)),
color: Colors.blue[200], color: Colors.blue[200],
......
// Message model
import 'package:flutter/cupertino.dart';
@immutable
class Message{
final String title;
final String body;
const Message({
@required this.title,
@required this.body,
});
}
\ No newline at end of file
This diff is collapsed.
import 'package:covidefender/pages/notificator/model/Notification_plugin.dart';
import 'package:flutter/material.dart';
import 'NotificationUI.dart';
class LocalNotificationScreen extends StatefulWidget {
@override
_LocalNotificationScreenState createState() =>
_LocalNotificationScreenState();
}
class _LocalNotificationScreenState extends State<LocalNotificationScreen> {
//
int count = 0;
@override
void initState() {
super.initState();
notificationPlugin
.setListenerForLowerVersions(onNotificationInLowerVersions);
notificationPlugin.setOnNotificationClick(onNotificationClick);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.green,
title: Text('Local Notifications'),
),
body: Center(
child: FlatButton(
onPressed: () async {
await notificationPlugin.showNotification();
// await notificationPlugin.scheduleNotification();
// await notificationPlugin.showNotificationWithAttachment();
await notificationPlugin.repeatNotification();
// await notificationPlugin.showDailyAtTime();
// await notificationPlugin.showWeeklyAtDayTime();
// count = await notificationPlugin.getPendingNotificationCount();
// print('Count $count');
// await notificationPlugin.cancelNotification();
// count = await notificationPlugin.getPendingNotificationCount();
// print('Count $count');
},
child: Text('Send Notification'),
),
),
);
}
onNotificationInLowerVersions(ReceivedNotification receivedNotification) {
print('Notification Received ${receivedNotification.id}');
}
onNotificationClick(String payload) {
print('Payload $payload');
Navigator.push(context, MaterialPageRoute(builder: (coontext) {
return NotificationScreen(
payload: payload,
);
}));
}
}
import 'package:flutter/material.dart';
import 'LocalNotificationUI.dart';
import 'notificator.dart';
class MainNotificationUI extends StatefulWidget {
//
final String payload;
MainNotificationUI({this.payload});
@override
_NotificationScreenState createState() => _NotificationScreenState();
}
class _NotificationScreenState extends State<MainNotificationUI> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.green,
title: Text('Smart Notifier'),
),
body: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('lib/assets/images/notify.gif'),
),
SizedBox(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.green[300],
elevation: 15,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)
)
),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context) => LocalNotificationScreen() ));
}, child: Text("Local Notifications")),
),
Padding(
padding: const EdgeInsets.fromLTRB(8,8,8,100),
child: SizedBox(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.green[300],
elevation: 15,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)
)
),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context) => MessagingWidget() ));
}, child: Text("Push Notifications")),
),
)
],
),
),
);
}
}
import 'package:flutter/material.dart';
class NotificationScreen extends StatefulWidget {
//
final String payload;
NotificationScreen({this.payload});
@override
_NotificationScreenState createState() => _NotificationScreenState();
}
class _NotificationScreenState extends State<NotificationScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Notifications Screen'),
),
body: Center(
child: Text(widget.payload),
),
);
}
}
import 'dart:ffi';
import 'package:covidefender/pages/notificator/model/Message.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
class MessagingWidget extends StatefulWidget {
// const MessagingWidget({Key? key}) : super(key: key);
@override
_MessagingWidgetState createState() => _MessagingWidgetState();
}
class _MessagingWidgetState extends State<MessagingWidget> {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
final List<Message> messages = [];
@override
Void initState() {
super.initState();
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
final notification = message['notification'];
setState(() {
messages.add(
Message(title: notification['title'], body: notification['body']));
});
print("OnMessage: $message");
}, onLaunch: (Map<String, dynamic> message) async {
final notification = message['notification'];
print("onLaunch: $message");
setState(() {
messages.add(
Message(title: notification['title'], body: notification['body']));
});
}, onResume: (Map<String, dynamic> message) async {
print("onResume: $message");
});
}
// @override
// Widget build(BuildContext context) => ListView(
// children: messages.map(buildMessage).toList(),
// );
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.green,
title: Text("Smart - Notificator "),
),
body: Container(
margin: EdgeInsets.only(bottom: 20, left: 10, right: 10, top: 10),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.blue.withOpacity(0.4),
blurRadius: 8,
offset: Offset(4, 4),
spreadRadius: 5)
],
gradient: LinearGradient(
colors: [Colors.green[600], Colors.white],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
borderRadius: BorderRadius.all(Radius.circular(20)),
),
child: ListView(
children: messages.map(buildMessage).toList(),
),
));
}
Widget buildMessage(Message message) => ListTile(
title: Text(
message.title != null ? message.title : "No messages Yet",
style: TextStyle(
color: Colors.white,
fontFamily: 'avenir',
),
),
subtitle: Text(message.body != null ? message.body:"empty"),
);
}
...@@ -35,7 +35,10 @@ dependencies: ...@@ -35,7 +35,10 @@ dependencies:
flutter_spinkit: "^4.1.2" flutter_spinkit: "^4.1.2"
google_fonts: ^1.1.2 google_fonts: ^1.1.2
flutter_sms: ^2.1.1 flutter_sms: ^2.1.1
firebase_messaging: ^4.0.0+1
rxdart: ^0.24.1
path_provider: ^1.6.11
flutter_local_notifications: ^1.4.4+1
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
...@@ -43,11 +46,8 @@ dependencies: ...@@ -43,11 +46,8 @@ dependencies:
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
http: ^0.12.2 http: ^0.12.2
#add dependencies for heart rate module
#add dependencies for heart rate module
camera: camera:
git: git:
...@@ -147,6 +147,7 @@ flutter: ...@@ -147,6 +147,7 @@ flutter:
- lib/assets/images/wear.gif - lib/assets/images/wear.gif
- lib/assets/images/hospital.gif - lib/assets/images/hospital.gif
- lib/assets/images/lab.gif - lib/assets/images/lab.gif
- lib/assets/images/notify.gif
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
# assets: # assets:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment