Commit e617db44 authored by Dio Maulana's avatar Dio Maulana

add youtube video

parent 04a97fbd
......@@ -2,13 +2,13 @@ class ConfigDisplay {
final String backgroundColorCarouselVideo;
final String textColor;
final String backgroundColorOrder;
final int isVideo;
final String mediaType;
ConfigDisplay(
{required this.backgroundColorCarouselVideo,
required this.textColor,
required this.backgroundColorOrder,
required this.isVideo});
required this.mediaType});
factory ConfigDisplay.createConfig(Map<String, dynamic> json) {
return ConfigDisplay(
......@@ -16,6 +16,6 @@ class ConfigDisplay {
json['background_color_carousel_video'].toString(),
textColor: json['text_color'].toString(),
backgroundColorOrder: json['background_color_order'],
isVideo: json['is_video']);
mediaType: json['media_type']);
}
}
......@@ -19,10 +19,9 @@ class _CarouselIndicatorState extends State<CarouselIndicator> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
// color: Colors.red,
// padding: EdgeInsets.only(top: MediaQuery.of(context).size.height *),
child: Container(
margin: const EdgeInsets.all(5.0),
// margin: const EdgeInsets.all(5.0),
child: ClipRRect(
borderRadius:
const BorderRadius.all(Radius.circular(5.0)),
......@@ -69,6 +68,8 @@ class _CarouselIndicatorState extends State<CarouselIndicator> {
autoPlay: true,
autoPlayInterval: const Duration(seconds: 5),
enlargeCenterPage: true,
viewportFraction: 1.0,
height: MediaQuery.of(context).size.height,
onPageChanged: (index, reason) {
setState(() {
_current = index;
......
......@@ -7,6 +7,7 @@ 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/video_promotion.dart';
import 'package:second_display/ui/youtube.dart';
// ignore: must_be_immutable
class MainPage extends StatelessWidget {
......@@ -35,19 +36,26 @@ class MainPage extends StatelessWidget {
return Row(
children: [
(configState[0].isVideo == 1)
(configState[0].mediaType == 'video')
? Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6,
color: colorBackgroundCarouselandVideo,
// color: Colors.white,
child: VideoPromotion(),
)
: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6,
child: CarouselIndicator(
backgroundColor: colorBackgroundCarouselandVideo),
),
: (configState[0].mediaType == 'image')
? Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6,
child: CarouselIndicator(
backgroundColor: colorBackgroundCarouselandVideo),
)
: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6,
child: YoutubeVideo(),
),
Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.4,
......
......@@ -73,8 +73,8 @@ class OrderPage extends StatelessWidget {
children: [
topList(context, "Order ID: " + list.id.toUpperCase(),
timeOrder),
topList(context, list.table_section_name,
"Tabel Section: " + list.table_name),
topList(context, list.table_name,
"Tabel Section: " + list.table_section_name),
],
)
],
......@@ -103,60 +103,70 @@ class OrderPage extends StatelessWidget {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
Container(
// color: Colors.white,
height:
MediaQuery.of(context).size.height * 0.05,
margin: EdgeInsets.only(
top: MediaQuery.of(context).size.height *
0.005,
bottom:
MediaQuery.of(context).size.height *
0),
child: Row(
children: [
listOforder(
context,
Alignment.centerLeft,
double.tryParse(
detailOrder[i].quantity)
.toString() +
" x " +
detailOrder[i].name),
listOforder(
context,
Alignment.centerRight,
amountEachOrderText)
],
),
),
for (int i = 0;
i < OrderOptionDetail.length;
i++)
Container(
margin: EdgeInsets.only(
bottom: MediaQuery.of(context).size.height *
0.01),
child: Column(
children: [
Container(
// color: Colors.white,
height: MediaQuery.of(context).size.height *
0.02,
0.05,
margin: EdgeInsets.only(
top:
MediaQuery.of(context).size.height *
0.001,
0.005,
bottom:
MediaQuery.of(context).size.height *
0.001),
0),
child: Row(
children: [
listOforderOption(
listOforder(
context,
Alignment.centerLeft,
double.tryParse(
detailOrder[i].quantity)
.toString() +
" x " +
detailOrder[i].name),
listOforder(
context,
Alignment.topLeft,
OrderOptionDetail[i].trim()),
listOforderOption(
context, Alignment.centerRight, '')
Alignment.centerRight,
amountEachOrderText)
],
),
),
],
for (int i = 0;
i < OrderOptionDetail.length;
i++)
Container(
// color: Colors.green,
height:
MediaQuery.of(context).size.height *
0.02,
margin: EdgeInsets.only(
top: MediaQuery.of(context)
.size
.height *
0.000,
bottom: MediaQuery.of(context)
.size
.height *
0.001),
child: Row(
children: [
listOforderOption(
context,
Alignment.topLeft,
OrderOptionDetail[i].trim()),
listOforderOption(context,
Alignment.centerRight, '')
],
),
),
],
),
)
],
);
......
......@@ -32,11 +32,11 @@ class _VideoPromotionState extends State<VideoPromotion> {
return Center(
child: Container(
// color: Colors.green,
margin: EdgeInsets.fromLTRB(
MediaQuery.of(context).size.width * 0.05,
MediaQuery.of(context).size.height * 0.1,
MediaQuery.of(context).size.width * 0.05,
MediaQuery.of(context).size.height * 0.1),
// margin: EdgeInsets.fromLTRB(
// MediaQuery.of(context).size.width * 0.05,
// MediaQuery.of(context).size.height * 0.1,
// MediaQuery.of(context).size.width * 0.05,
// MediaQuery.of(context).size.height * 0.1),
child: _controller!.value.isInitialized
? AspectRatio(
aspectRatio: _controller!.value.aspectRatio,
......
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
class YoutubeVideo extends StatefulWidget {
const YoutubeVideo({Key? key}) : super(key: key);
@override
State<YoutubeVideo> createState() => _YoutubeVideoState();
}
class _YoutubeVideoState extends State<YoutubeVideo> {
@override
Widget build(BuildContext context) {
var widthYoutbe = MediaQuery.of(context).size.width * 0.6;
var heighYoutbe = MediaQuery.of(context).size.height;
return Center(
child: Container(
// color: Colors.green,
child: Html(
data:
'<iframe width="$widthYoutbe" height="$heighYoutbe" src="https://www.youtube.com/embed/Mi72fOuiwA0?rel=0&modestbranding=1&autoplay=1&mute=1&enablejsapi=1&controls=0&loop=1&autohide=1" frameborder="0" clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
)),
);
}
}
......@@ -43,6 +43,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
chewie:
dependency: transitive
description:
name: chewie
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
chewie_audio:
dependency: transitive
description:
name: chewie_audio
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
clock:
dependency: transitive
description:
......@@ -78,6 +92,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
flutter:
dependency: "direct main"
description: flutter
......@@ -90,6 +111,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.1"
flutter_html:
dependency: "direct main"
description:
name: flutter_html
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
flutter_layout_grid:
dependency: transitive
description:
name: flutter_layout_grid
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.6"
flutter_lints:
dependency: "direct dev"
description:
......@@ -97,6 +132,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
flutter_math_fork:
dependency: transitive
description:
name: flutter_math_fork
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0"
flutter_svg:
dependency: transitive
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.23.0+1"
flutter_test:
dependency: "direct dev"
description: flutter
......@@ -184,6 +233,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
numerus:
dependency: transitive
description:
name: numerus
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
path:
dependency: transitive
description:
......@@ -191,6 +247,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.1+1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
plugin_platform_interface:
dependency: transitive
description:
......@@ -205,6 +282,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.2"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1+1"
sky_engine:
dependency: transitive
description: flutter
......@@ -252,6 +336,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.8"
tuple:
dependency: transitive
description:
name: tuple
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
typed_data:
dependency: transitive
description:
......@@ -273,6 +364,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
very_good_analysis:
dependency: transitive
description:
name: very_good_analysis
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
video_player:
dependency: "direct main"
description:
......@@ -308,6 +406,83 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
wakelock:
dependency: transitive
description:
name: wakelock
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1+2"
wakelock_macos:
dependency: transitive
description:
name: wakelock_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
wakelock_platform_interface:
dependency: transitive
description:
name: wakelock_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
wakelock_web:
dependency: transitive
description:
name: wakelock_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
wakelock_windows:
dependency: transitive
description:
name: wakelock_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
webview_flutter:
dependency: transitive
description:
name: webview_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.0"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.3"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
url: "https://pub.dartlang.org"
source: hosted
version: "2.7.1"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.1"
sdks:
dart: ">=2.16.1 <3.0.0"
flutter: ">=2.8.0"
......@@ -32,6 +32,7 @@ dependencies:
flutter:
sdk: flutter
flutter_bloc: ^8.0.1
flutter_html: ^2.2.1
http: ^0.13.4
intl: ^0.17.0
loading_animations: ^2.2.0
......
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