Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Q
queue_flutter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ernanda
queue_flutter
Commits
97c154c2
Commit
97c154c2
authored
Mar 01, 2022
by
valdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
succes clear data
parent
d125b466
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
25 deletions
+49
-25
baseurl.json
assets/baseurl.json
+3
-0
config.dart
lib/helper/config.dart
+4
-2
main_page.dart
lib/main_page.dart
+39
-23
pubspec.yaml
pubspec.yaml
+3
-0
No files found.
assets/baseurl.json
0 → 100644
View file @
97c154c2
{
"baseUrl"
:
"http://192.168.2.142:8000/"
}
\ No newline at end of file
lib/helper/config.dart
View file @
97c154c2
import
'package:mqtt_client/mqtt_browser_client.dart'
;
import
'package:mqtt_client/mqtt_browser_client.dart'
;
const
String
apiUrlQueue
=
"http://192.168.2.142:8000/api/getqueue"
;
const
String
baseUrl
=
"http://192.168.2.142:8000/"
;
const
String
apiUrlUpdate
=
"http://192.168.2.142:8000/api/updatequeue"
;
const
String
apiUrlQueue
=
baseUrl
+
"api/getqueue"
;
const
String
apiUrlUpdate
=
baseUrl
+
"api/updatequeue"
;
const
String
apiUrlClear
=
baseUrl
+
"api/clearqueue"
;
const
String
mqttUrl
=
"ws://dev.ravku.com"
;
const
String
mqttUrl
=
"ws://dev.ravku.com"
;
const
String
queueTopic
=
"queuetest/1"
;
const
String
queueTopic
=
"queuetest/1"
;
const
String
queueMessage
=
"updateApi"
;
const
String
queueMessage
=
"updateApi"
;
...
...
lib/main_page.dart
View file @
97c154c2
...
@@ -25,6 +25,7 @@ class _MainPageState extends State<MainPage> {
...
@@ -25,6 +25,7 @@ class _MainPageState extends State<MainPage> {
List
<
String
>
queueSelected
=
[];
List
<
String
>
queueSelected
=
[];
List
<
String
>
readySelected
=
[];
List
<
String
>
readySelected
=
[];
List
<
String
>
pickUp
=
[];
List
<
String
>
pickUp
=
[];
List
clearData
=
[
OrderQueue
];
void
setToReady
(
List
queueSelected
)
async
{
void
setToReady
(
List
queueSelected
)
async
{
var
apiUrl
=
apiUrlUpdate
;
var
apiUrl
=
apiUrlUpdate
;
...
@@ -98,6 +99,20 @@ class _MainPageState extends State<MainPage> {
...
@@ -98,6 +99,20 @@ class _MainPageState extends State<MainPage> {
mqClient
.
publishMessage
(
pubTopic
,
MqttQos
.
exactlyOnce
,
builder
.
payload
!);
mqClient
.
publishMessage
(
pubTopic
,
MqttQos
.
exactlyOnce
,
builder
.
payload
!);
}
}
// ignore: non_constant_identifier_names
Future
setToClear
()
async
{
// print(readySelected);
var
apiUrl
=
apiUrlClear
;
var
apiResult
=
await
http
.
get
(
Uri
.
parse
(
apiUrl
));
var
jsonObject
=
jsonDecode
(
apiResult
.
body
)[
'status'
];
if
(
jsonObject
==
true
)
{
context
.
read
<
ReadyCubit
>().
getData
();
context
.
read
<
QueueCubit
>().
getData
();
}
else
{
print
(
"gabisa"
);
}
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
context
.
read
<
QueueCubit
>().
getData
();
context
.
read
<
QueueCubit
>().
getData
();
...
@@ -230,7 +245,7 @@ class _MainPageState extends State<MainPage> {
...
@@ -230,7 +245,7 @@ class _MainPageState extends State<MainPage> {
setToReady
(
queueSelected
);
setToReady
(
queueSelected
);
},
},
child:
Container
(
child:
Container
(
width:
10
00
,
width:
8
00
,
height:
100
,
height:
100
,
color:
Colors
.
lightBlue
,
color:
Colors
.
lightBlue
,
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
...
@@ -253,25 +268,25 @@ class _MainPageState extends State<MainPage> {
...
@@ -253,25 +268,25 @@ class _MainPageState extends State<MainPage> {
child:
Container
(
child:
Container
(
color:
Colors
.
blueGrey
,
color:
Colors
.
blueGrey
,
child:
Column
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
<
Widget
>[
children:
<
Widget
>[
Container
(
//
Container(
width:
400
,
//
width: 400,
height:
100
,
//
height: 100,
margin:
EdgeInsets
.
all
(
20
),
//
margin: EdgeInsets.all(20),
decoration:
BoxDecoration
(
//
decoration: BoxDecoration(
borderRadius:
BorderRadius
.
all
(
//
borderRadius: BorderRadius.all(
Radius
.
circular
(
20
),
//
Radius.circular(20),
),
//
),
color:
Colors
.
amber
,
//
color: Colors.amber,
),
//
),
alignment:
Alignment
.
center
,
//
alignment: Alignment.center,
child:
Text
(
//
child: Text(
"REFRESH"
,
//
"REFRESH",
style:
TextStyle
(
//
style: TextStyle(
fontSize:
30
,
fontWeight:
FontWeight
.
w700
),
//
fontSize: 30, fontWeight: FontWeight.w700),
),
//
),
),
//
),
InkWell
(
InkWell
(
onTap:
()
{
onTap:
()
{
print
(
"clear"
);
print
(
"clear"
);
...
@@ -279,14 +294,15 @@ class _MainPageState extends State<MainPage> {
...
@@ -279,14 +294,15 @@ class _MainPageState extends State<MainPage> {
context:
context
,
context:
context
,
builder:
(
BuildContext
context
)
=>
AlertDialog
(
builder:
(
BuildContext
context
)
=>
AlertDialog
(
title:
Text
(
"Clear"
),
title:
Text
(
"Clear"
),
content:
Text
(
"Are you sure to clear?"
),
content:
Text
(
"Are you sure to clear
data
?"
),
actions:
<
Widget
>[
actions:
<
Widget
>[
TextButton
(
TextButton
(
onPressed:
()
=>
Navigator
.
pop
(
context
),
onPressed:
()
=>
Navigator
.
pop
(
context
),
child:
Text
(
'Cancel'
),
child:
Text
(
'Cancel'
),
),
),
TextButton
(
TextButton
(
onPressed:
()
=>
Navigator
.
pop
(
context
),
onPressed:
()
=>
Navigator
.
pop
(
context
,
setToClear
),
child:
Text
(
'OK'
),
child:
Text
(
'OK'
),
),
),
],
],
...
@@ -295,8 +311,8 @@ class _MainPageState extends State<MainPage> {
...
@@ -295,8 +311,8 @@ class _MainPageState extends State<MainPage> {
},
},
child:
Container
(
child:
Container
(
width:
400
,
width:
400
,
height:
10
0
,
height:
8
0
,
margin:
EdgeInsets
.
all
(
2
0
),
margin:
EdgeInsets
.
all
(
1
0
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
all
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
20
),
Radius
.
circular
(
20
),
...
...
pubspec.yaml
View file @
97c154c2
...
@@ -38,6 +38,7 @@ dependencies:
...
@@ -38,6 +38,7 @@ dependencies:
shared_preferences
:
^2.0.13
shared_preferences
:
^2.0.13
uuid
:
^3.0.6
uuid
:
^3.0.6
dev_dependencies
:
dev_dependencies
:
flutter_lints
:
^1.0.0
flutter_lints
:
^1.0.0
flutter_test
:
flutter_test
:
...
@@ -47,6 +48,8 @@ dev_dependencies:
...
@@ -47,6 +48,8 @@ dev_dependencies:
# following page: https://dart.dev/tools/pub/pubspec
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
# The following section is specific to Flutter.
flutter
:
flutter
:
# assets:
# - assets/baseurl.json
# The following line ensures that the Material Icons font is
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# included with your application, so that you can use the icons in
...
...
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