Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
second_display
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
Dio Maulana
second_display
Commits
3e6d6da2
Commit
3e6d6da2
authored
Apr 08, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mempersimple codingan
parent
caea547d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
52 deletions
+46
-52
general.dart
lib/ui/settings/general.dart
+46
-52
No files found.
lib/ui/settings/general.dart
View file @
3e6d6da2
...
...
@@ -12,66 +12,60 @@ class GeneralSetting extends StatefulWidget {
class
_GeneralSettingState
extends
State
<
GeneralSetting
>
{
@override
Widget
build
(
BuildContext
context
)
{
final
bool
?
isOrderActive
=
prefs
.
getBool
(
'isOrderActive'
)
;
final
bool
?
isAdActive
=
prefs
.
getBool
(
'isAdActive'
)
;
final
bool
isOrderActive
=
prefs
.
getBool
(
'isOrderActive'
)
??
true
;
final
bool
isAdActive
=
prefs
.
getBool
(
'isAdActive'
)
??
true
;
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
"General Setting"
),
backgroundColor:
backgroundAppBar
,
),
body:
Column
(
body:
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
,
child:
ListView
(
children:
[
Container
(
color:
Colors
.
black
.
withOpacity
(
0.5
),
height:
50
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
1
,
child:
Container
(
margin:
EdgeInsets
.
only
(
left:
10
),
child:
const
Align
(
alignment:
Alignment
.
centerLeft
,
child:
Text
(
"General"
)),
),
),
Container
(
margin:
const
EdgeInsets
.
only
(
left:
10
,
right:
10
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
"Tampilkan Order"
,
style:
TextStyle
(
fontSize:
MediaQuery
.
of
(
context
).
size
.
height
*
0.025
,
fontWeight:
FontWeight
.
w500
),
),
Switch
(
value:
(
isOrderActive
==
null
)
?
true
:
isOrderActive
,
onChanged:
(
bool
newValue
)
async
{
await
prefs
.
setBool
(
'isOrderActive'
,
newValue
);
setState
(()
{});
})
titleHeader
(
context
,
"General"
),
listWithSwitch
(
isOrderActive
,
"Tampilkan Order"
,
"isOrderActive"
),
listWithSwitch
(
isAdActive
,
"Tampilkan Iklan"
,
"isAdActive"
),
],
),
),
Container
(
margin:
const
EdgeInsets
.
only
(
left:
10
,
right:
10
),
);
}
Container
listWithSwitch
(
bool
isOrderActive
,
String
title
,
String
prefName
)
{
return
Container
(
margin:
const
EdgeInsets
.
only
(
left:
10
,
right:
10
,
top:
15
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
"Tampilkan Iklan"
,
style:
TextStyle
(
fontSize:
MediaQuery
.
of
(
context
).
size
.
height
*
0.025
,
fontWeight:
FontWeight
.
w500
),
title
,
style:
const
TextStyle
(
fontSize:
20
,
fontWeight:
FontWeight
.
w500
),
),
Switch
(
value:
(
isAdActive
==
null
)
?
true
:
isAd
Active
,
value:
isOrder
Active
,
onChanged:
(
bool
newValue
)
async
{
await
prefs
.
setBool
(
'isAdActive'
,
newValue
);
await
prefs
.
setBool
(
prefName
,
newValue
);
setState
(()
{});
})
],
),
)
],
);
}
Container
titleHeader
(
BuildContext
context
,
String
title
)
{
return
Container
(
color:
Colors
.
black
.
withOpacity
(
0.5
),
height:
50
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
1
,
child:
Container
(
margin:
const
EdgeInsets
.
only
(
left:
10
),
child:
Align
(
alignment:
Alignment
.
centerLeft
,
child:
Text
(
title
,
style:
const
TextStyle
(
fontWeight:
FontWeight
.
w600
,
fontSize:
20
),
)),
),
);
}
...
...
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