Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 35
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
0
Merge Requests
0
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
22_23-J 35
22_23-J 35
Commits
5d04e799
Commit
5d04e799
authored
May 11, 2023
by
madushanmac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created option page
parent
81a12eb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
0 deletions
+114
-0
lib/screens/options.dart
lib/screens/options.dart
+114
-0
No files found.
lib/screens/options.dart
View file @
5d04e799
import
'package:flutter/material.dart'
;
import
'dart:async'
show
Future
;
import
'dart:convert'
;
import
'package:http/http.dart'
as
http
;
class
Options
extends
StatefulWidget
{
const
Options
({
Key
?
key
})
:
super
(
key:
key
);
State
<
Options
>
createState
()
=>
_OptionsState
();
}
class
_OptionsState
extends
State
<
Options
>
{
late
List
users
;
bool
loading
=
false
;
Future
<
String
>
getUsers
()
async
{
setState
(()
=>
loading
=
true
);
var
url
=
Uri
.
parse
(
'https://jsonplaceholder.typicode.com/users'
);
var
response
=
await
http
.
get
(
url
);
setState
(()
=>
users
=
json
.
decode
(
response
.
body
.
toString
()));
setState
(()
=>
loading
=
false
);
return
'success'
;
}
@override
void
dispose
()
{
super
.
dispose
();
}
@override
void
initState
()
{
super
.
initState
();
getUsers
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
body:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
const
SizedBox
(
height:
55
,
),
//app navigation bar
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
25.0
),
child:
GestureDetector
(
child:
Container
(
height:
50
,
padding:
EdgeInsets
.
all
(
2
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Colors
.
white
),
borderRadius:
BorderRadius
.
circular
(
12
),
color:
Color
.
fromARGB
(
255
,
97
,
96
,
96
)),
child:
Image
.
asset
(
'lib/icons/back.png'
,
),
),
onTap:
(){
Navigator
.
pop
(
context
);
print
(
'go back pressed'
);
},
),
),
const
SizedBox
(
height:
20
,),
Container
(
color:
Colors
.
grey
,
height:
40
,
child:
Center
(
child:
Text
(
'Reports '
,
style:
TextStyle
(
fontSize:
30.0
,
fontWeight:
FontWeight
.
bold
),))
),
const
SizedBox
(
height:
50
,),
Column
(
children:
<
Widget
>[
loading
?
const
Center
(
child:
CircularProgressIndicator
(),
heightFactor:
12.0
,
)
:
Expanded
(
child:
ListView
.
builder
(
itemCount:
users
==
null
?
0
:
users
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
var
name
=
users
[
index
][
'name'
];
var
email
=
users
[
index
][
'email'
];
return
Column
(
children:
<
Widget
>[
ListTile
(
leading:
const
CircleAvatar
(
child:
Icon
(
Icons
.
account_box
),
),
title:
Text
(
name
),
subtitle:
Text
(
email
),
),
const
Divider
(),
],
);
}),
),
],
)
],
)
);
}
}
\ No newline at end of file
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