Commit f0eae93a authored by Dio Maulana's avatar Dio Maulana

perbaiki tampilan

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