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
4787dbd4
Commit
4787dbd4
authored
Apr 07, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
menambahkan double back ketika exit
parent
8a93e9ea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
147 additions
and
84 deletions
+147
-84
main_page.dart
lib/ui/main_page.dart
+147
-84
No files found.
lib/ui/main_page.dart
View file @
4787dbd4
...
...
@@ -7,22 +7,44 @@ import 'package:second_display/main.dart';
import
'package:second_display/models/config_display.dart'
;
import
'package:second_display/ui/carousel.dart'
;
import
'package:second_display/ui/orders.dart'
;
import
'package:second_display/ui/settings/menu_setting.dart'
;
import
'package:second_display/ui/video_promotion.dart'
;
import
'package:second_display/ui/youtube.dart'
;
import
'package:double_back_to_close/double_back_to_close.dart'
;
// ignore: must_be_immutable
class
MainPage
extends
StatelessWidget
{
bool
isOrderActive
=
true
;
MainPage
({
Key
?
key
})
:
super
(
key:
key
);
class
MainPage
extends
StatefulWidget
{
const
MainPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
MainPage
>
createState
()
=>
_MainPageState
();
}
class
_MainPageState
extends
State
<
MainPage
>
{
final
bool
isOrderActive
=
prefs
.
getBool
(
'isOrderActive'
)
??
true
;
final
bool
isAdActive
=
prefs
.
getBool
(
'isAdActive'
)
??
true
;
bool
allowClose
=
false
;
@override
Widget
build
(
BuildContext
context
)
{
context
.
read
<
OrdersBloc
>().
getOrderList
();
context
.
read
<
OrderDetailBloc
>().
getOrderDetailList
();
return
SafeArea
(
return
DoubleBack
(
message:
"Press back again to close"
,
condition:
allowClose
,
onConditionFail:
()
{
setState
(()
{
allowClose
=
true
;
});
},
waitForSecondBackPress:
3
,
child:
SafeArea
(
child:
MaterialApp
(
debugShowCheckedModeBanner:
false
,
home:
Scaffold
(
body:
BlocBuilder
<
ConfigDisplayBloc
,
List
<
ConfigDisplay
>>(
home:
Scaffold
(
body:
BlocBuilder
<
ConfigDisplayBloc
,
List
<
ConfigDisplay
>>(
builder:
(
context
,
configState
)
{
if
(
configState
.
isEmpty
)
{
navigatorKey
.
currentState
?.
pushNamed
(
'/error'
);
...
...
@@ -48,9 +70,12 @@ class MainPage extends StatelessWidget {
images
.
add
(
imageString
[
i
].
trim
());
}
prefs
.
setStringList
(
"imageList"
,
images
);
return
Row
(
return
Stack
(
children:
[
(
configState
[
0
].
mediaType
==
'video'
)
Row
(
children:
[
(
isAdActive
)
?
(
configState
[
0
].
mediaType
==
'video'
)
?
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
,
width:
(
isOrderActive
)
...
...
@@ -59,33 +84,43 @@ class MainPage extends StatelessWidget {
color:
colorBackgroundCarouselandVideo
,
// color: Colors.white,
child:
VideoPromotion
(
videoUrl:
configState
[
0
].
videoPromotionUrl
),
videoUrl:
configState
[
0
].
videoPromotionUrl
),
)
:
(
configState
[
0
].
mediaType
==
'image'
)
?
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
,
?
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
,
width:
(
isOrderActive
)
?
MediaQuery
.
of
(
context
).
size
.
width
*
0.6
:
MediaQuery
.
of
(
context
).
size
.
width
*
1
,
?
MediaQuery
.
of
(
context
).
size
.
width
*
0.6
:
MediaQuery
.
of
(
context
).
size
.
width
*
1
,
child:
CarouselIndicator
(
backgroundColor:
colorBackgroundCarouselandVideo
),
)
:
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
,
:
SizedBox
(
height:
MediaQuery
.
of
(
context
).
size
.
height
,
width:
(
isOrderActive
)
?
MediaQuery
.
of
(
context
).
size
.
width
*
0.6
:
MediaQuery
.
of
(
context
).
size
.
width
*
1
,
?
MediaQuery
.
of
(
context
).
size
.
width
*
0.6
:
MediaQuery
.
of
(
context
).
size
.
width
*
1
,
child:
YoutubeVideo
(
backgroundColor:
colorBackgroundCarouselandVideo
,
youtubeId:
configState
[
0
].
youtubeId
,
isOrderActive:
isOrderActive
),
),
)
:
const
SizedBox
(
height:
0
,
width:
0
),
(
isOrderActive
)
?
Container
(
height:
MediaQuery
.
of
(
context
).
size
.
height
,
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.4
,
width:
(
isAdActive
)
?
MediaQuery
.
of
(
context
).
size
.
width
*
0.4
:
MediaQuery
.
of
(
context
).
size
.
width
*
1
,
color:
backgroundColorOrder
,
// decoration: const BoxDecoration(
// gradient: LinearGradient(
...
...
@@ -100,10 +135,38 @@ class MainPage extends StatelessWidget {
)
:
const
SizedBox
(
height:
0
,
width:
0
)
],
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
Container
(
margin:
EdgeInsets
.
only
(
top:
MediaQuery
.
of
(
context
).
size
.
height
*
0.01
,
left:
MediaQuery
.
of
(
context
).
size
.
height
*
0.01
),
child:
GestureDetector
(
onTap:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
const
SettingsMenu
(),
),
);
},
child:
Icon
(
Icons
.
settings
,
color:
textColor
,
),
),
),
],
)
],
);
},
)),
),
),
);
}
}
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