Commit e617db44 authored by Dio Maulana's avatar Dio Maulana

add youtube video

parent 04a97fbd
...@@ -2,13 +2,13 @@ class ConfigDisplay { ...@@ -2,13 +2,13 @@ class ConfigDisplay {
final String backgroundColorCarouselVideo; final String backgroundColorCarouselVideo;
final String textColor; final String textColor;
final String backgroundColorOrder; final String backgroundColorOrder;
final int isVideo; final String mediaType;
ConfigDisplay( ConfigDisplay(
{required this.backgroundColorCarouselVideo, {required this.backgroundColorCarouselVideo,
required this.textColor, required this.textColor,
required this.backgroundColorOrder, required this.backgroundColorOrder,
required this.isVideo}); required this.mediaType});
factory ConfigDisplay.createConfig(Map<String, dynamic> json) { factory ConfigDisplay.createConfig(Map<String, dynamic> json) {
return ConfigDisplay( return ConfigDisplay(
...@@ -16,6 +16,6 @@ class ConfigDisplay { ...@@ -16,6 +16,6 @@ class ConfigDisplay {
json['background_color_carousel_video'].toString(), json['background_color_carousel_video'].toString(),
textColor: json['text_color'].toString(), textColor: json['text_color'].toString(),
backgroundColorOrder: json['background_color_order'], backgroundColorOrder: json['background_color_order'],
isVideo: json['is_video']); mediaType: json['media_type']);
} }
} }
...@@ -19,10 +19,9 @@ class _CarouselIndicatorState extends State<CarouselIndicator> { ...@@ -19,10 +19,9 @@ class _CarouselIndicatorState extends State<CarouselIndicator> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( Container(
// color: Colors.red,
// padding: EdgeInsets.only(top: MediaQuery.of(context).size.height *), // padding: EdgeInsets.only(top: MediaQuery.of(context).size.height *),
child: Container( child: Container(
margin: const EdgeInsets.all(5.0), // margin: const EdgeInsets.all(5.0),
child: ClipRRect( child: ClipRRect(
borderRadius: borderRadius:
const BorderRadius.all(Radius.circular(5.0)), const BorderRadius.all(Radius.circular(5.0)),
...@@ -69,6 +68,8 @@ class _CarouselIndicatorState extends State<CarouselIndicator> { ...@@ -69,6 +68,8 @@ class _CarouselIndicatorState extends State<CarouselIndicator> {
autoPlay: true, autoPlay: true,
autoPlayInterval: const Duration(seconds: 5), autoPlayInterval: const Duration(seconds: 5),
enlargeCenterPage: true, enlargeCenterPage: true,
viewportFraction: 1.0,
height: MediaQuery.of(context).size.height,
onPageChanged: (index, reason) { onPageChanged: (index, reason) {
setState(() { setState(() {
_current = index; _current = index;
......
...@@ -7,6 +7,7 @@ import 'package:second_display/models/config_display.dart'; ...@@ -7,6 +7,7 @@ import 'package:second_display/models/config_display.dart';
import 'package:second_display/ui/carousel.dart'; import 'package:second_display/ui/carousel.dart';
import 'package:second_display/ui/orders.dart'; import 'package:second_display/ui/orders.dart';
import 'package:second_display/ui/video_promotion.dart'; import 'package:second_display/ui/video_promotion.dart';
import 'package:second_display/ui/youtube.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class MainPage extends StatelessWidget { class MainPage extends StatelessWidget {
...@@ -35,19 +36,26 @@ class MainPage extends StatelessWidget { ...@@ -35,19 +36,26 @@ class MainPage extends StatelessWidget {
return Row( return Row(
children: [ children: [
(configState[0].isVideo == 1) (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: MediaQuery.of(context).size.width * 0.6,
color: colorBackgroundCarouselandVideo, color: colorBackgroundCarouselandVideo,
// color: Colors.white,
child: VideoPromotion(), child: VideoPromotion(),
) )
: Container( : (configState[0].mediaType == 'image')
height: MediaQuery.of(context).size.height, ? Container(
width: MediaQuery.of(context).size.width * 0.6, height: MediaQuery.of(context).size.height,
child: CarouselIndicator( width: MediaQuery.of(context).size.width * 0.6,
backgroundColor: colorBackgroundCarouselandVideo), child: CarouselIndicator(
), backgroundColor: colorBackgroundCarouselandVideo),
)
: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6,
child: YoutubeVideo(),
),
Container( Container(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.4, width: MediaQuery.of(context).size.width * 0.4,
......
...@@ -73,8 +73,8 @@ class OrderPage extends StatelessWidget { ...@@ -73,8 +73,8 @@ class OrderPage extends StatelessWidget {
children: [ children: [
topList(context, "Order ID: " + list.id.toUpperCase(), topList(context, "Order ID: " + list.id.toUpperCase(),
timeOrder), timeOrder),
topList(context, list.table_section_name, topList(context, list.table_name,
"Tabel Section: " + list.table_name), "Tabel Section: " + list.table_section_name),
], ],
) )
], ],
...@@ -103,60 +103,70 @@ class OrderPage extends StatelessWidget { ...@@ -103,60 +103,70 @@ class OrderPage extends StatelessWidget {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Column( Container(
children: [ margin: EdgeInsets.only(
Container( bottom: MediaQuery.of(context).size.height *
// color: Colors.white, 0.01),
height: child: Column(
MediaQuery.of(context).size.height * 0.05, children: [
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( Container(
// color: Colors.white,
height: MediaQuery.of(context).size.height * height: MediaQuery.of(context).size.height *
0.02, 0.05,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: top:
MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
0.001, 0.005,
bottom: bottom:
MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
0.001), 0),
child: Row( child: Row(
children: [ children: [
listOforderOption( listOforder(
context,
Alignment.centerLeft,
double.tryParse(
detailOrder[i].quantity)
.toString() +
" x " +
detailOrder[i].name),
listOforder(
context, context,
Alignment.topLeft, Alignment.centerRight,
OrderOptionDetail[i].trim()), amountEachOrderText)
listOforderOption(
context, Alignment.centerRight, '')
], ],
), ),
), ),
], 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> { ...@@ -32,11 +32,11 @@ class _VideoPromotionState extends State<VideoPromotion> {
return Center( return Center(
child: Container( child: Container(
// color: Colors.green, // color: Colors.green,
margin: EdgeInsets.fromLTRB( // margin: EdgeInsets.fromLTRB(
MediaQuery.of(context).size.width * 0.05, // MediaQuery.of(context).size.width * 0.05,
MediaQuery.of(context).size.height * 0.1, // MediaQuery.of(context).size.height * 0.1,
MediaQuery.of(context).size.width * 0.05, // MediaQuery.of(context).size.width * 0.05,
MediaQuery.of(context).size.height * 0.1), // MediaQuery.of(context).size.height * 0.1),
child: _controller!.value.isInitialized child: _controller!.value.isInitialized
? AspectRatio( ? AspectRatio(
aspectRatio: _controller!.value.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: ...@@ -43,6 +43,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.1" 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: clock:
dependency: transitive dependency: transitive
description: description:
...@@ -78,6 +92,13 @@ packages: ...@@ -78,6 +92,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
...@@ -90,6 +111,20 @@ packages: ...@@ -90,6 +111,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.0.1" 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: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
...@@ -97,6 +132,20 @@ packages: ...@@ -97,6 +132,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" 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: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
...@@ -184,6 +233,13 @@ packages: ...@@ -184,6 +233,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
numerus:
dependency: transitive
description:
name: numerus
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
path: path:
dependency: transitive dependency: transitive
description: description:
...@@ -191,6 +247,27 @@ packages: ...@@ -191,6 +247,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" 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: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
...@@ -205,6 +282,13 @@ packages: ...@@ -205,6 +282,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.2" version: "6.0.2"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1+1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
...@@ -252,6 +336,13 @@ packages: ...@@ -252,6 +336,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.8" version: "0.4.8"
tuple:
dependency: transitive
description:
name: tuple
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
...@@ -273,6 +364,13 @@ packages: ...@@ -273,6 +364,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" 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: video_player:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -308,6 +406,83 @@ packages: ...@@ -308,6 +406,83 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.7" 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: sdks:
dart: ">=2.16.1 <3.0.0" dart: ">=2.16.1 <3.0.0"
flutter: ">=2.8.0" flutter: ">=2.8.0"
...@@ -32,6 +32,7 @@ dependencies: ...@@ -32,6 +32,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_bloc: ^8.0.1 flutter_bloc: ^8.0.1
flutter_html: ^2.2.1
http: ^0.13.4 http: ^0.13.4
intl: ^0.17.0 intl: ^0.17.0
loading_animations: ^2.2.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