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
3ea85076
Commit
3ea85076
authored
Feb 23, 2022
by
valdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
panggil api
parent
a9203a16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
160 additions
and
100 deletions
+160
-100
api.dart
lib/api.dart
+3
-2
ready_bloc.dart
lib/bloc/ready_bloc.dart
+29
-0
data.dart
lib/data.dart
+2
-0
main.dart
lib/main.dart
+7
-1
main_page.dart
lib/main_page.dart
+110
-92
queue.dart
lib/models/queue.dart
+1
-5
pubspec.lock
pubspec.lock
+7
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
lib/api.dart
View file @
3ea85076
...
...
@@ -12,12 +12,13 @@ class ApiQueue {
ApiQueue
(
this
.
id
,
this
.
queue_number
,
this
.
status
);
factory
ApiQueue
.
createQueue
(
Map
<
String
,
dynamic
>
json
)
{
return
ApiQueue
(
json
[
'
id'
].
toString
(),
json
[
'queue_number'
].
toString
(),
json
[
'status'
]
);
return
ApiQueue
(
json
[
'id'
].
toString
(),
json
[
'queue_number'
].
toString
(),
json
[
'
status'
].
toString
()
);
}
static
Future
<
List
<
OrderQueue
>>
getQueue
()
async
{
String
apiUrl
=
"http://192.168.2.142:8000/api/getqueue"
;
// print("Test");
List
<
OrderQueue
>
queues
=
[];
try
{
var
apiResult
=
await
http
.
get
(
Uri
.
parse
(
apiUrl
));
...
...
lib/bloc/ready_bloc.dart
0 → 100644
View file @
3ea85076
import
'package:bloc/bloc.dart'
;
import
'package:manager_queue/api.dart'
;
import
'package:manager_queue/models/queue.dart'
;
class
ReadyBloc
extends
Cubit
<
List
<
OrderQueue
>>
{
ReadyBloc
()
:
super
([]);
Future
<
List
<
OrderQueue
>>
getData
()
async
{
var
apiQueue
=
await
ApiQueue
.
getQueue
();
return
apiQueue
;
}
// List<OrderQueue> queues = [
// OrderQueue(id: "1", queue_number: '123', status: 'Ready'),
// OrderQueue(id: "2", queue_number: '1234', status: 'Ready'),
// OrderQueue(id: "3", queue_number: '12345', status: 'queue'),
// OrderQueue(id: "4", queue_number: '123456', status: 'queue'),
// OrderQueue(id: "5", queue_number: '12345633', status: 'Ready'),
// ];
// ReadyBloc() : super(Future.empty);
void
queueList
()
{
getData
().
then
((
value
)
{
// print(value);
emit
(
value
);
});
}
}
lib/data.dart
View file @
3ea85076
class
Queue
{
String
id
,
nomor
,
status
;
Queue
({
required
this
.
id
,
required
this
.
nomor
,
required
this
.
status
});
static
where
(
bool
Function
(
dynamic
i
)
param0
)
{}
}
List
<
Queue
>
Queues
=
[
...
...
lib/main.dart
View file @
3ea85076
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:manager_queue/bloc/queue_bloc.dart'
;
import
'package:manager_queue/bloc/ready_bloc.dart'
;
import
'package:manager_queue/main_page.dart'
;
void
main
(
)
{
...
...
@@ -11,7 +14,10 @@ class MyApp extends StatelessWidget {
return
MaterialApp
(
initialRoute:
'/'
,
routes:
{
'/'
:
(
context
)
=>
MainPage
(),
'/'
:
(
context
)
=>
MultiBlocProvider
(
providers:
[
BlocProvider
(
create:
(
_
)
=>
QueueBloc
()),
BlocProvider
(
create:
(
_
)
=>
ReadyBloc
()),
],
child:
MainPage
()),
},
debugShowCheckedModeBanner:
false
,
);
...
...
lib/main_page.dart
View file @
3ea85076
This diff is collapsed.
Click to expand it.
lib/models/queue.dart
View file @
3ea85076
class
OrderQueue
{
final
String
id
;
// ignore: non_constant_identifier_names
final
String
queue_number
;
final
String
status
;
OrderQueue
(
// ignore: non_constant_identifier_names
{
required
this
.
id
,
required
this
.
queue_number
,
required
this
.
status
});
{
required
this
.
id
,
required
this
.
queue_number
,
required
this
.
status
});
factory
OrderQueue
.
createOrderQueue
(
Map
<
String
,
dynamic
>
json
)
{
return
OrderQueue
(
...
...
pubspec.lock
View file @
3ea85076
...
...
@@ -130,6 +130,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
multi_select_flutter:
dependency: "direct main"
description:
name: multi_select_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
nested:
dependency: transitive
description:
...
...
pubspec.yaml
View file @
3ea85076
...
...
@@ -32,6 +32,7 @@ dependencies:
sdk
:
flutter
flutter_bloc
:
^8.0.1
http
:
^0.13.4
multi_select_flutter
:
^4.0.0
dev_dependencies
:
...
...
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