Commit f0eae93a authored by Dio Maulana's avatar Dio Maulana

perbaiki tampilan

parent 90dd4942
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.second_display"> package="com.example.second_display">
<uses-permission android:name="android.permission.INTERNET" />
<application <application
android:label="second_display" android:label="second_display"
android:name="${applicationName}" android:name="${applicationName}"
......
...@@ -37,7 +37,7 @@ class Api { ...@@ -37,7 +37,7 @@ class Api {
/// load data dari api midware getby id /// load data dari api midware getby id
/// load data dari midwar file json /// load data dari midware file json
Map data = {}; Map data = {};
var bodi = jsonEncode(data); var bodi = jsonEncode(data);
......
...@@ -8,72 +8,75 @@ class ErrorPage extends StatelessWidget { ...@@ -8,72 +8,75 @@ class ErrorPage extends StatelessWidget {
final String? baseUrls = prefs.getString('base_url'); final String? baseUrls = prefs.getString('base_url');
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Container(
mainAxisAlignment: MainAxisAlignment.center, color: Colors.white,
children: [ child: Column(
SizedBox( mainAxisAlignment: MainAxisAlignment.center,
width: MediaQuery.of(context).size.width * 0.2, children: [
height: MediaQuery.of(context).size.width * 0.2, SizedBox(
child: const Image( width: MediaQuery.of(context).size.width * 0.2,
image: AssetImage("assets/images/error.png"), height: MediaQuery.of(context).size.width * 0.2,
fit: BoxFit.cover, child: const Image(
)), image: AssetImage("assets/images/error.png"),
SizedBox( fit: BoxFit.cover,
height: MediaQuery.of(context).size.height * 0.05, )),
), SizedBox(
Text( height: MediaQuery.of(context).size.height * 0.05,
"Error connect to server, Need to refresh and check the server", ),
style: TextStyle( Text(
fontSize: MediaQuery.of(context).size.height * 0.03, "Error connect to server, Need to refresh and check the server",
fontWeight: FontWeight.w500, style: TextStyle(
color: Colors.black, fontSize: MediaQuery.of(context).size.height * 0.03,
decoration: TextDecoration.none), fontWeight: FontWeight.w500,
), color: Colors.black,
Row( decoration: TextDecoration.none),
mainAxisAlignment: MainAxisAlignment.center, ),
children: [ Row(
Text( mainAxisAlignment: MainAxisAlignment.center,
"Your Base Url: ", children: [
style: TextStyle( Text(
fontSize: MediaQuery.of(context).size.height * 0.02, "Your Base Url: ",
fontWeight: FontWeight.w500, style: TextStyle(
color: Colors.black, fontSize: MediaQuery.of(context).size.height * 0.02,
decoration: TextDecoration.none), fontWeight: FontWeight.w500,
), color: Colors.black,
Text( decoration: TextDecoration.none),
baseUrls ?? urlDefault, ),
style: TextStyle( Text(
fontSize: MediaQuery.of(context).size.height * 0.02, baseUrls ?? urlDefault,
fontWeight: FontWeight.w500, style: TextStyle(
color: Colors.red, fontSize: MediaQuery.of(context).size.height * 0.02,
decoration: TextDecoration.none), fontWeight: FontWeight.w500,
), color: Colors.red,
], decoration: TextDecoration.none),
), ),
SizedBox( ],
height: MediaQuery.of(context).size.height * 0.05, ),
), SizedBox(
Row( height: MediaQuery.of(context).size.height * 0.05,
mainAxisAlignment: MainAxisAlignment.center, ),
children: [ Row(
ElevatedButton.icon( mainAxisAlignment: MainAxisAlignment.center,
onPressed: () { children: [
Navigator.pushReplacementNamed(context, '/'); ElevatedButton.icon(
}, onPressed: () {
icon: const Icon(Icons.refresh_sharp), Navigator.pushReplacementNamed(context, '/');
label: const Text("Refresh")), },
SizedBox( icon: const Icon(Icons.refresh_sharp),
width: MediaQuery.of(context).size.width * 0.01, label: const Text("Refresh")),
), SizedBox(
ElevatedButton.icon( width: MediaQuery.of(context).size.width * 0.01,
onPressed: () { ),
Navigator.pushReplacementNamed(context, '/inputbase'); ElevatedButton.icon(
}, onPressed: () {
icon: const Icon(Icons.input_outlined), Navigator.pushReplacementNamed(context, '/inputbase');
label: const Text("Input base Url")) },
], icon: const Icon(Icons.input_outlined),
) label: const Text("Input base Url"))
], ],
)
],
),
); );
} }
} }
...@@ -12,6 +12,7 @@ import 'package:second_display/ui/youtube.dart'; ...@@ -12,6 +12,7 @@ import 'package:second_display/ui/youtube.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class MainPage extends StatelessWidget { class MainPage extends StatelessWidget {
bool isOrderActive = true;
MainPage({Key? key}) : super(key: key); MainPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -52,7 +53,9 @@ class MainPage extends StatelessWidget { ...@@ -52,7 +53,9 @@ class MainPage extends StatelessWidget {
(configState[0].mediaType == 'video') (configState[0].mediaType == 'video')
? Container( ? Container(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6, width: (isOrderActive)
? MediaQuery.of(context).size.width * 0.6
: MediaQuery.of(context).size.width * 1,
color: colorBackgroundCarouselandVideo, color: colorBackgroundCarouselandVideo,
// color: Colors.white, // color: Colors.white,
child: VideoPromotion( child: VideoPromotion(
...@@ -61,25 +64,41 @@ class MainPage extends StatelessWidget { ...@@ -61,25 +64,41 @@ class MainPage extends StatelessWidget {
: (configState[0].mediaType == 'image') : (configState[0].mediaType == 'image')
? Container( ? Container(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6, width: (isOrderActive)
? MediaQuery.of(context).size.width * 0.6
: MediaQuery.of(context).size.width * 1,
child: CarouselIndicator( child: CarouselIndicator(
backgroundColor: backgroundColor:
colorBackgroundCarouselandVideo), colorBackgroundCarouselandVideo),
) )
: Container( : Container(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6, width: (isOrderActive)
? MediaQuery.of(context).size.width * 0.6
: MediaQuery.of(context).size.width * 1,
child: YoutubeVideo( child: YoutubeVideo(
backgroundColor: backgroundColor:
colorBackgroundCarouselandVideo, colorBackgroundCarouselandVideo,
youtubeId: configState[0].youtubeId), youtubeId: configState[0].youtubeId,
isOrderActive: isOrderActive),
), ),
Container( (isOrderActive)
height: MediaQuery.of(context).size.height, ? Container(
width: MediaQuery.of(context).size.width * 0.4, height: MediaQuery.of(context).size.height,
color: backgroundColorOrder, width: MediaQuery.of(context).size.width * 0.4,
child: OrderPage(textColor: textColor), color: backgroundColorOrder,
) // decoration: const BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// Colors.blue,
// Colors.white,
// ],
// )),
child: OrderPage(textColor: textColor),
)
: const SizedBox(height: 0, width: 0)
], ],
); );
}, },
......
import 'dart:html';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
......
...@@ -6,8 +6,12 @@ import 'package:youtube_player_iframe/youtube_player_iframe.dart'; ...@@ -6,8 +6,12 @@ import 'package:youtube_player_iframe/youtube_player_iframe.dart';
class YoutubeVideo extends StatefulWidget { class YoutubeVideo extends StatefulWidget {
final String youtubeId; final String youtubeId;
final Color backgroundColor; final Color backgroundColor;
final bool isOrderActive;
const YoutubeVideo( const YoutubeVideo(
{Key? key, required this.youtubeId, required this.backgroundColor}) {Key? key,
required this.youtubeId,
required this.backgroundColor,
required this.isOrderActive})
: super(key: key); : super(key: key);
@override @override
...@@ -48,7 +52,9 @@ class _YoutubeVideoState extends State<YoutubeVideo> { ...@@ -48,7 +52,9 @@ class _YoutubeVideoState extends State<YoutubeVideo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var widthYoutbe = MediaQuery.of(context).size.width * 0.6; var widthYoutbe = (widget.isOrderActive)
? MediaQuery.of(context).size.width * 0.6
: MediaQuery.of(context).size.width * 1;
var heighYoutbe = MediaQuery.of(context).size.height; var heighYoutbe = MediaQuery.of(context).size.height;
// return Center( // return Center(
// child: Container( // child: Container(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment