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
ab511e9a
Commit
ab511e9a
authored
Apr 07, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
menambahkan getIP dan getwifi name
parent
51e2ac36
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
splash.dart
lib/ui/splash.dart
+19
-7
No files found.
lib/ui/splash.dart
View file @
ab511e9a
import
'package:dart_ipify/dart_ipify.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:loading_animations/loading_animations.dart'
;
import
'package:network_info_plus/network_info_plus.dart'
;
import
'package:second_display/api/api.dart'
;
import
'package:second_display/bloc/config_display_blog.dart'
;
import
'package:second_display/helper/config.dart'
;
...
...
@@ -17,6 +17,7 @@ class Splash extends StatefulWidget {
State
<
Splash
>
createState
()
=>
_SplashState
();
}
final
info
=
NetworkInfo
();
Future
<
List
<
ConfigDisplay
>>
config
(
String
url
)
async
{
List
<
ConfigDisplay
>
apiConfigs
=
[];
try
{
...
...
@@ -28,14 +29,26 @@ Future<List<ConfigDisplay>> config(String url) async {
}
}
void
getIp
(
)
async
{
final
ipv4
=
await
Ipify
.
ipv4
();
await
prefs
.
setString
(
'ipAddress'
,
ipv4
);
}
void
getWifi
(
)
async
{
final
wifiNames
=
await
info
.
getWifiName
()
??
'Not Found'
;
await
prefs
.
setString
(
'wifiName'
,
wifiNames
);
}
class
_SplashState
extends
State
<
Splash
>
{
@override
void
initState
()
{
String
?
base_urlapi
=
prefs
.
getString
(
'base_url'
);
config
(
base_urlapi
??
urlDefault
).
then
((
value
)
async
{
getIp
();
getWifi
();
String
?
baseUrlapi
=
prefs
.
getString
(
'base_url'
);
config
(
baseUrlapi
??
urlDefault
).
then
((
value
)
async
{
context
.
read
<
ConfigDisplayBloc
>()
.
getConfigDisplay
(
base
_u
rlapi
??
urlDefault
);
.
getConfigDisplay
(
base
U
rlapi
??
urlDefault
);
await
prefs
.
setString
(
'background_color_carousel_video'
,
value
[
0
].
backgroundColorCarouselVideo
);
await
prefs
.
setString
(
'text_color'
,
value
[
0
].
textColor
);
...
...
@@ -45,8 +58,7 @@ class _SplashState extends State<Splash> {
await
prefs
.
setString
(
'youtubeId'
,
value
[
0
].
youtubeId
);
await
prefs
.
setString
(
'videoPromotionUrl'
,
value
[
0
].
videoPromotionUrl
);
await
prefs
.
setString
(
'images'
,
value
[
0
].
images
);
Future
.
delayed
(
const
Duration
(
seconds:
3
),
()
{
Future
.
delayed
(
const
Duration
(
seconds:
1
),
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
MainPage
()));
});
});
...
...
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