Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-035-CoviDefender
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-035
2021-035-CoviDefender
Commits
a5f54e55
Commit
a5f54e55
authored
Jul 28, 2021
by
Indika NK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding changes related to push notifications
parent
db4da9bd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
117 additions
and
3 deletions
+117
-3
android/app/src/main/AndroidManifest.xml
android/app/src/main/AndroidManifest.xml
+4
-0
lib/I_GUIDER/i_guider.dart
lib/I_GUIDER/i_guider.dart
+7
-3
lib/pages/notificator/model/Message.dart
lib/pages/notificator/model/Message.dart
+15
-0
lib/pages/notificator/ui/notificator.dart
lib/pages/notificator/ui/notificator.dart
+90
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
android/app/src/main/AndroidManifest.xml
View file @
a5f54e55
...
...
@@ -31,6 +31,10 @@
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
<intent-filter>
<action
android:name=
"FLUTTER_NOTIFICATION_CLICK"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
...
...
lib/I_GUIDER/i_guider.dart
View file @
a5f54e55
import
'package:covidefender/pages/heart_rate/heart_rate_screen.dart'
;
import
'package:covidefender/pages/mask_detect/invoker.dart'
;
import
'package:covidefender/pages/notificator/ui/notificator.dart'
;
import
'package:covidefender/pages/self_carer/sc_main_screen.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -51,12 +52,12 @@ class I_guider extends StatelessWidget {
icon:
Column
(
children:
[
Icon
(
Icons
.
bluetooth_audio_rounded
,
Icons
.
notifications
,
size:
40
,
color:
Colors
.
white
,
),
SizedBox
(
height:
20
),
Text
(
"
BT Distance
r"
,
style:
TextStyle
(
Text
(
"
Notificato
r"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
white
)
,)
...
...
@@ -64,7 +65,10 @@ class I_guider extends StatelessWidget {
),
label:
Text
(
''
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
)),
onPressed:
()
{},
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
MessagingWidget
()
));
},
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
10
)),
color:
Colors
.
blue
[
200
],
...
...
lib/pages/notificator/model/Message.dart
0 → 100644
View file @
a5f54e55
// 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
lib/pages/notificator/ui/notificator.dart
0 → 100644
View file @
a5f54e55
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
(
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
.
blue
[
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"
),
);
}
pubspec.yaml
View file @
a5f54e55
...
...
@@ -35,6 +35,7 @@ dependencies:
flutter_spinkit
:
"
^4.1.2"
google_fonts
:
^1.1.2
flutter_sms
:
^2.1.1
firebase_messaging
:
^4.0.0+1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment