Skip to content

Instantly share code, notes, and snippets.

@dilshod1d
Created April 11, 2023 06:57
Show Gist options
  • Save dilshod1d/9edafda11d1507769da5976b454bda13 to your computer and use it in GitHub Desktop.
Save dilshod1d/9edafda11d1507769da5976b454bda13 to your computer and use it in GitHub Desktop.
Homepage 2
import 'dart:convert';
import 'dart:ui';
import 'package:StreamFlix/model/video.dart';
import 'package:StreamFlix/pages/Seeall.dart';
import 'package:StreamFlix/pages/profile.dart';
import 'package:StreamFlix/pages/root_app.dart';
import 'package:StreamFlix/pages/search_page.dart';
import 'package:StreamFlix/pages/video_details_bottom.dart';
import 'package:StreamFlix/utils/local_storage.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:StreamFlix/json/home_json.dart';
import 'package:StreamFlix/pages/video_detail_page.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:http/http.dart' as http;
import 'package:remixicon/remixicon.dart';
import 'package:shimmer/shimmer.dart';
import '../bloc/continue_watching/continue_watching_bloc.dart';
import '../widgets/new_and_hot_tile_action.dart';
import 'continue_watching.dart';
import 'home_movie.dart';
import 'movie_detail_page.dart';
class HomePage2 extends StatefulWidget {
// HomePage2({key, this.openGenre});
// final Function() openGenre;
@override
_HomePage2State createState() => _HomePage2State();
}
class _HomePage2State extends State<HomePage2> {
final _scrollController = ScrollController();
List<Video> _videos = [];
var firebaseUser = FirebaseAuth.instance.currentUser;
Future parseProducts(String responseBody) async {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
video = parsed.map<Video>((json) => Video.fromJson(json)).toList();
final movieInMyListLocal = await LocalStorage.getListMoviesInMyList();
if (movieInMyListLocal.isNotEmpty) {
for (var key in movieInMyListLocal.keys) {
final videoModel = Video.fromJson(movieInMyListLocal[key]);
if (video.every((element) => element.name != videoModel.name)) {
video.add(videoModel);
}
}
}
// video.shuffle();
setState(() {});
}
void parsepopularbollywoodcrime(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
popularbollywoodcrime =
parsed.map<Video>((json) => Video.fromJson(json)).toList();
// popularbollywoodcrime.shuffle();
popularbollywoodcrime = popularbollywoodcrime
.where((element) => element.series == "yes")
.toList();
// popularbollywoodcrime.shuffle();
});
}
void parsepopular(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
popular = parsed.map<Video>((json) => Video.fromJson(json)).toList();
// popular.shuffle();
popular = popular.where((element) => element.series == "yes").toList();
// popular.shuffle();
});
}
void parsekorean(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
korean = parsed.map<Video>((json) => Video.fromJson(json)).toList();
// korean.shuffle();
korean = korean.where((element) => element.series == "yes").toList();
// korean.shuffle();
});
}
void parsetrending(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
trending = parsed.map<Video>((json) => Video.fromJson(json)).toList();
// trending.shuffle();
trending = trending.where((element) => element.series == "yes").toList();
// trending.shuffle();
});
}
String tokenlink;
List<Token> _postList = new List<Token>();
void parsetoken(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
token = parsed.map<Token>((json) => Token.fromJson(json)).toList();
});
List<dynamic> values = new List<dynamic>();
values = json.decode(responseBody);
if (values.length > 0) {
for (int i = 0; i < values.length; i++) {
if (values[i] != null) {
Map<String, dynamic> map = values[i];
_postList.add(Token.fromJson(map));
tokenlink = map["token"];
}
}
}
}
String azurelink;
List<Azure> azurelist = new List<Azure>();
void parseazure(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
link = parsed.map<Azure>((json) => Azure.fromJson(json)).toList();
});
List<dynamic> values = new List<dynamic>();
values = json.decode(responseBody);
if (values.length > 0) {
for (int i = 0; i < values.length; i++) {
if (values[i] != null) {
Map<String, dynamic> map = values[i];
azurelist.add(Azure.fromJson(map));
azurelink = map["link"];
}
}
}
}
Future<void> fetchazure() async {
try {
final responsetoken = await http.get(azureurl);
if (responsetoken.statusCode == 200) {
parseazure(responsetoken.body);
}
} catch (e) {
print(e.toString());
}
}
List<Azure> link = [];
List<Video> video = [];
List<Seriess> seriess = [];
List<Token> token = [];
List<Video> korean = [];
List<Video> popular = [];
List<Video> trending = [];
List<Video> south = [];
List<Video> complete = [];
List<Video> scifi = [];
List<Video> action = [];
List<Video> popularbollywoodcrime = [];
List<Video> horror = [];
List<Video> romantic = [];
var url = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/stream");
var tokenurl = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/blob");
var azureurl = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/azure");
var urlpopular = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/popularseries");
var koreanlink = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/korean");
var urltrending = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/trending");
var urlpopularbollywoodcrime = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/popularbollywoodcrime");
var urlcomplete = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/main");
List<Video> newreleases = [];
List<Video> punjabi = [];
List<Video> ustvshows = [];
List<Video> anime = [];
List<Video> adventure = [];
var urlanime = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/anime");
var urlustvshows = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/ustvshows");
var urlnewreleases = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/newreleases");
var urlpunjabi = Uri.parse(
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/punjabidrama");
Future<void> fetchanime() async {
final response = await http.get(urlanime);
if (response.statusCode == 200) {
parseanime(response.body);
} else {
throw Exception('Unable to fetch products from the REST API');
}
}
Future<void> fetchustvshows() async {
final response = await http.get(urlustvshows);
if (response.statusCode == 200) {
parseustvshows(response.body);
} else {
throw Exception('Unable to fetch products from the REST API');
}
}
Future<void> fetchnewreleases() async {
final response = await http.get(urlnewreleases);
if (response.statusCode == 200) {
parsenewreleases(response.body);
} else {
throw Exception('Unable to fetch products from the REST API');
}
}
Future<void> fetchpunjabi() async {
final response = await http.get(urlpunjabi);
if (response.statusCode == 200) {
parsepunjabi(response.body);
} else {
throw Exception('Unable to fetch products from the REST API');
}
}
void parseanime(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
anime = parsed.map<Video>((json) => Video.fromJson(json)).toList();
anime = anime.where((element) => element.series == "yes").toList();
// anime.shuffle();
});
}
void parseustvshows(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
ustvshows = parsed.map<Video>((json) => Video.fromJson(json)).toList();
ustvshows =
ustvshows.where((element) => element.series == "yes").toList();
// ustvshows.shuffle();
});
}
void parsenewreleases(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
newreleases = parsed.map<Video>((json) => Video.fromJson(json)).toList();
newreleases =
newreleases.where((element) => element.series == "yes").toList();
// newreleases.shuffle();
});
}
void parsepunjabi(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
punjabi = parsed.map<Video>((json) => Video.fromJson(json)).toList();
punjabi = punjabi.where((element) => element.series == "yes").toList();
// punjabi.shuffle();
});
}
void parsecomplete(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
complete = parsed.map<Video>((json) => Video.fromJson(json)).toList();
complete =
complete.where((element) => element.series == "yes").toSet().toList();
complete.shuffle();
scifi = parsed.map<Video>((json) => Video.fromJson(json)).toList();
scifi = scifi
.where((element) => element.genres.contains("Si-Fi"))
.toSet()
.toList();
scifi = scifi.where((element) => element.series == "yes").toList();
action = parsed.map<Video>((json) => Video.fromJson(json)).toList();
action =
action.where((element) => element.genres.contains("Action")).toList();
action =
action.where((element) => element.series == "yes").toSet().toList();
action.shuffle();
adventure = parsed.map<Video>((json) => Video.fromJson(json)).toList();
adventure = adventure
.where((element) => element.genres.contains("Adventure"))
.toList();
adventure = adventure
.where((element) => element.series == "yes")
.toSet()
.toList();
adventure.shuffle();
horror = parsed.map<Video>((json) => Video.fromJson(json)).toList();
horror =
horror.where((element) => element.genres.contains("Horror")).toList();
horror =
horror.where((element) => element.series == "yes").toSet().toList();
horror.shuffle();
romantic = parsed.map<Video>((json) => Video.fromJson(json)).toList();
romantic = romantic
.where((element) => element.genres.contains("Romance"))
.toList();
romantic =
romantic.where((element) => element.series == "yes").toSet().toList();
horror.shuffle();
});
}
void parsesouth(String responseBody) {
final parsed = json.decode(responseBody).cast<Map<String, dynamic>>();
setState(() {
south = parsed.map<Video>((json) => Video.fromJson(json)).toList();
south = south.where((element) => element.series == "yes").toList();
south =
south.where((element) => element.genres.contains("South")).toList();
});
}
Future<void> fetchsouth() async {
final response = await http.get(urlcomplete);
if (response.statusCode == 200) {
parsesouth(response.body);
} else {
throw Exception('Unable to fetch products from the REST API');
}
}
Future<void> fetchcomplete() async {
final response = await http.get(urlcomplete);
if (response.statusCode == 200) {
parsecomplete(response.body);
} else {
throw Exception('Unable to fetch products from the REST API');
}
}
Future<void> fetchProducts() async {
try {
final response = await http.get(url);
if (response.statusCode == 200) {
await parseProducts(response.body);
}
} catch (e) {
print(e.toString());
}
}
Future<void> fetchtrending() async {
try {
final response = await http.get(urltrending);
if (response.statusCode == 200) {
parsetrending(response.body);
}
} catch (e) {
print(e.toString());
}
}
Future<void> fetchtoken() async {
try {
final responsetoken = await http.get(tokenurl);
if (responsetoken.statusCode == 200) {
parsetoken(responsetoken.body);
}
} catch (e) {
print(e.toString());
}
}
Future<void> popularlist() async {
final response = await http.get(urlpopular);
if (response.statusCode == 200) {
parsepopular(response.body);
} else {
throw Exception('Unable to fetch products from the REST API');
}
}
Future<void> koreanlist() async {
final response = await http.get(koreanlink);
if (response.statusCode == 200) {
parsekorean(response.body);
} else {
throw Exception('Unable to fetch products from the REST API');
}
}
Future<void> popularbollywoodcrimelist() async {
final response = await http.get(urlpopularbollywoodcrime);
if (response.statusCode == 200) {
parsepopularbollywoodcrime(response.body);
} else {
throw Exception('Unable to fetch products from the REST API');
}
}
TabController _tabController;
Future<bool> _onWillPop() async {
print("on will pop");
if (_tabController.index == 0) {
await SystemNavigator.pop();
}
Future.delayed(Duration(milliseconds: 200), () {
print("set index");
_tabController.index = 0;
});
print("return");
Navigator.push(context, MaterialPageRoute(builder: (context) => RootApp()));
return _tabController.index == 0;
}
final _scrollController = ScrollController();
double _scrollOffset = 0;
int page = 1;
final _scrollControllerGenre = ScrollController();
@override
void initState() {
super.initState();
fetchProducts();
fetchtoken();
popularlist();
popularbollywoodcrimelist();
koreanlist();
fetchcomplete();
fetchazure();
fetchtrending();
fetchustvshows();
fetchnewreleases();
fetchanime();
fetchsouth();
fetchpunjabi();
BlocProvider.of<ContinueWatchingBloc>(context)
.add(GetListContinueWatching());
_scrollController.addListener(_onScroll);
_scrollControllerGenre.addListener(_onScrollGenre);
}
void _onScroll() {
setState(() {
if (_scrollController.offset <= 140) {
_scrollOffset = _scrollController.offset;
} else {
_scrollOffset = 140;
}
});
}
void _onScrollGenre() {
setState(() {
if (_scrollControllerGenre.offset <= 140) {
_scrollOffset = _scrollControllerGenre.offset;
} else {
_scrollOffset = 140;
}
});
if (_scrollControllerGenre.position.atEdge &&
_scrollControllerGenre.offset != 0) {
setState(() {
page++;
});
}
}
bool _isShowGenre = false;
double _opacity = 0;
void _closeGenre() async {
for (int i = 0; i < 5; i++) {
await Future.delayed(const Duration(milliseconds: 25));
setState(() {
_opacity -= 0.2;
});
}
setState(() {
_isShowGenre = false;
});
}
void _openGenre() async {
setState(() {
_isShowGenre = true;
});
for (int i = 0; i < 5; i++) {
await Future.delayed(const Duration(milliseconds: 25));
setState(() {
_opacity += 0.2;
});
}
}
OverlayEntry overlay;
bool seetvshow = true;
MaterialColor kPrimaryColor = const MaterialColor(
0x00000000,
const <int, Color>{
50: const Color(0x00000000),
100: const Color(0x00000000),
200: const Color(0x00000000),
300: const Color(0x00000000),
400: const Color(0x00000000),
500: const Color(0x00000000),
600: const Color(0x00000000),
700: const Color(0x00000000),
800: const Color(0x00000000),
900: const Color(0x00000000),
},
);
@override
Widget build(BuildContext context) {
return MaterialApp(
themeMode: ThemeMode.dark,
debugShowCheckedModeBanner: false,
theme: ThemeData(
textTheme: TextTheme(
headline1: TextStyle(color: Colors.white),
headline2: TextStyle(color: Colors.white),
bodyText2: TextStyle(color: Colors.white),
subtitle1: TextStyle(color: Colors.white),
),
primarySwatch: kPrimaryColor,
// add tabBarTheme
),
home: WillPopScope(
onWillPop: _onWillPop,
child: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
),
child: (_isShowGenre)
? Scaffold(
backgroundColor: Colors.transparent,
body: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: _opacity * 30, sigmaY: _opacity * 30),
child: Opacity(
opacity: _opacity,
child: Stack(
children: [
ListView.separated(
padding: const EdgeInsets.fromLTRB(0, 50, 0, 100),
separatorBuilder: (context, index) =>
const SizedBox(height: 35),
itemCount: categorieslist.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Navigator.of(context, rootNavigator: true)
.push(MaterialPageRoute(
builder: (_) => Seeall(
videoUrl:
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/main",
type: "category",
tokenLink: tokenlink,
azurelink: azurelink,
title: categorieslist[index]["tag"]),
));
_closeGenre();
},
child: Text(
categorieslist[index]["tag"],
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
color: Colors.white.withOpacity(0.8)),
),
);
},
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
margin: const EdgeInsets.only(bottom: 20),
child: GestureDetector(
onTap: _closeGenre,
child: const Icon(
Remix.close_circle_fill,
size: 65,
color: Colors.red,
))),
)
],
),
),
),
)
: Scaffold(
extendBody: true,
extendBodyBehindAppBar: true,
backgroundColor: Colors.black,
resizeToAvoidBottomInset: false,
body: Stack(
children: [
// ignore: missing_return
Builder(builder: (_) {
if (seetvshow) {
return getBody();
}
if (!seetvshow) {
return HomeMovie(
scrollController: _scrollController,
);
}
}),
Positioned(
top: 0,
left: 0,
right: 0,
child: ClipRect(
child: BackdropFilter(
filter: _scrollOffset >= 140
? ImageFilter.blur(sigmaX: 10, sigmaY: 10)
: ImageFilter.blur(sigmaX: 0, sigmaY: 0),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
_scrollOffset >= 140
? Colors.black.withOpacity(0.7)
: Colors.transparent,
_scrollOffset >= 140
? Colors.black.withOpacity(0.7)
: Colors.black.withOpacity(
_scrollOffset / 145),
// Colors.transparent.withOpacity(_scrollOffset / 145)
])),
width: double.infinity,
padding: const EdgeInsets.only(
left: 15, top: 40, bottom: 0, right: 25),
child: Column(
children: [
Row(
children: [
Image.asset(
'assets/images/logo.png',
height: 38.0,
width: 40,
),
const Spacer(),
InkWell(
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(MaterialPageRoute(
builder: (context) =>
SearchPage()));
},
child: Icon(Icons.search,
color: Colors.white),
),
const SizedBox(
width: 15,
),
GestureDetector(
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(MaterialPageRoute(
builder: (context) =>
Profile()));
},
child: CircleAvatar(
radius: 15.0,
backgroundImage: NetworkImage(
firebaseUser?.photoURL == null
? "https://i.ibb.co/VHv69j4/Clipart-Key-1414123.png"
: firebaseUser.photoURL),
backgroundColor:
Colors.transparent,
),
),
],
),
SizedBox(
height: 60 - (40 * _scrollOffset / 140),
child: Padding(
padding: const EdgeInsets.only(
left: 20,
right: 20,
bottom: 20,
top: 20),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
InkWell(
onTap: () {
setState(() {
seetvshow = true;
});
},
child: Row(
children: [
(seetvshow)
? Text(
"TV Shows",
style: TextStyle(
fontStyle:
FontStyle
.normal,
color: Colors
.white,
fontWeight:
FontWeight
.bold),
)
: Text("TV Shows"),
],
),
),
InkWell(
onTap: () {
setState(() {
seetvshow = false;
});
},
child: Row(
children: [
(!seetvshow)
? Text("Movies",
style: TextStyle(
fontStyle:
FontStyle
.normal,
color: Colors
.white,
fontWeight:
FontWeight
.bold))
: Text("Movies"),
],
),
),
InkWell(
onTap: () {
overlay = OverlayEntry(
builder: (context) {
return MaterialApp(
theme: ThemeData(
primarySwatch:
kPrimaryColor,
),
home: WillPopScope(
onWillPop: () async {
overlay.remove();
return true;
},
child: Scaffold(
backgroundColor:
Colors.black
.withOpacity(
.9),
body: Center(
child: ListView
.builder(
itemCount:
categorieslist
.length,
shrinkWrap:
true,
itemBuilder:
((context,
index) {
var season =
index + 1;
return Padding(
padding: const EdgeInsets
.symmetric(
horizontal:
48.0),
child:
InkWell(
child:
Padding(
padding:
const EdgeInsets.all(16.0),
child:
Text(
categorieslist[index]
[
"tag"],
style: const TextStyle(
color: Colors.grey,
fontSize: 18.0),
textAlign:
TextAlign.center,
),
),
onTap:
() {
Navigator.of(context,
rootNavigator: true)
.push(MaterialPageRoute(
builder: (_) =>
Seeall(
videoUrl:
"https://streamflix.azureedge.net/streamapi/api-main/streamflix/main",
type:
"category",
tokenLink:
tokenlink,
azurelink:
azurelink,
title:
categorieslist[index]["tag"],
video:
video,
),
));
overlay
.remove();
},
),
);
}),
),
),
floatingActionButton:
FloatingActionButton(
backgroundColor:
Colors
.white,
onPressed:
() {
overlay
.remove();
},
child:
const Icon(
Icons
.close,
color: Colors
.black,
)),
floatingActionButtonLocation:
FloatingActionButtonLocation
.centerDocked,
),
),
);
},
);
Overlay.of(context,
rootOverlay: true)
?.insert(overlay);
},
child: Row(
children: [
Text('Categories'),
const SizedBox(width: 5),
Opacity(
opacity: 1 -
(_scrollOffset /
140),
child: Icon(
Remix
.arrow_down_s_line,
color: Colors.white,
)),
],
),
),
],
),
),
)
],
)),
),
))
],
),
),
),
),
);
}
final shimmerGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: <Color>[
Colors.grey[900],
Colors.grey[900],
Colors.grey[800],
Colors.grey[900],
Colors.grey[900]
],
stops: const <double>[
0.0,
0.35,
0.5,
0.65,
1.0
]);
Widget getBody() {
var size = MediaQuery.of(context).size;
final width = MediaQuery.of(context).size.width;
return Padding(
padding: const EdgeInsets.only(bottom: 0),
child: SingleChildScrollView(
controller: _scrollController,
child: Stack(children: [
Container(
width: size.height - 80,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(
complete.length < 1 ? complete.length : 1,
(index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
CachedNetworkImage(
imageUrl: "${complete[index].image}".replaceAll(
"_V1._SX350.jpg", "_V1._SX500.jpg"),
imageBuilder: (context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Image(
image: imageProvider,
fit: BoxFit.fill,
width: width,
height: 540,
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
color: Colors.black),
width: width,
height: 540),
),
errorWidget: (context, url, error) => Container(
width: 110.0,
height: 220.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
Container(
height: 550,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.black,
Colors.transparent,
Colors.transparent,
Colors.black54
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
stops: [0, 0.6, 0.6, 1],
))),
Container(
height: 550,
width: size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Divider(
height: 15,
color: Colors.black,
),
Row(
children: [
Expanded(
child: Text(
"${complete[index].genres}"
.replaceAll(",", " • "),
softWrap: false,
maxLines: 2,
textAlign: TextAlign.center,
overflow:
TextOverflow.ellipsis, // new
),
),
],
),
],
),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
GestureDetector(
onTap: () {
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList: video.indexWhere(
(element) =>
element.name ==
complete[index].name) !=
-1,
onRemove: () async {
video.removeAt(index);
setState(() {});
await LocalStorage
.removeMovieFromMyList(
video[index].name);
},
video: complete[index],
onMyListTap: () async {
video.insert(0, complete[index]);
setState(() {});
await LocalStorage.addMovieToMyList(
complete[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: GestureDetector(
onTap: () async {
final _index = video.indexWhere((element) =>
element.name == complete[index].name);
if (_index != -1) {
Fluttertoast.showToast(
msg: "Removed from My List", // message
toastLength:
Toast.LENGTH_SHORT, // length
gravity:
ToastGravity.BOTTOM, // location
timeInSecForIosWeb: 1 // duration
);
await LocalStorage.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
} else {
Fluttertoast.showToast(
msg: "Added to My List", // message
toastLength:
Toast.LENGTH_SHORT, // length
gravity:
ToastGravity.BOTTOM, // location
timeInSecForIosWeb: 1 // duration
);
video.insert(0, complete[index]);
setState(() {});
await LocalStorage.addMovieToMyList(
complete[index]);
}
},
child: NewAndHotTileAction(
icon: video.indexWhere((element) =>
element.name ==
complete[index].name) !=
-1
? Icons.check
: Icons.add,
label: video.indexWhere((element) =>
element.name ==
complete[index].name) !=
-1
? "Added"
: 'My List',
),
),
),
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 12.0, vertical: 4.0),
backgroundColor: Colors.white,
foregroundColor: Colors.black),
onPressed: () {
final _index = video.indexWhere((element) =>
element.name == video[index].name);
if (complete[index].series == "not") {
Navigator.of(context, rootNavigator: true)
.push(MaterialPageRoute(
builder: (_) => MovieDetailPage(
title: complete[index].name,
description:
complete[index].description,
cast: complete[index].cast,
video: complete[index].video,
time: complete[index].time,
trailer:
complete[index].trailer,
videoModel: complete[index],
subtitle:
complete[index].subtitle,
isExistFromMyList: _index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
onMyListTap: () async {
video.insert(
0, complete[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
complete[index]);
},
img: complete[index].image,
token: tokenlink,
azure: azurelink,
age: complete[index].age,
year: complete[index].date,
genres:
complete[index].genres)));
} else {
Navigator.of(context, rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => VideoDetailPage(
title: complete[index].name,
description:
complete[index].description,
cast: complete[index].cast,
seriess: complete[index].seriess,
//seriess: test.testList,
img: complete[index].image,
isExistFromMyList: _index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
onMyListTap: () async {
video.insert(0, complete[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
complete[index]);
},
subtitle: complete[index].subtitle,
token: tokenlink,
azure: azurelink,
trailer: complete[index].trailer,
video: complete[index].video,
age: complete[index].age,
year: complete[index].date,
genres: complete[index].genres),
),
);
}
},
icon: const Icon(Icons.play_arrow),
label: const Text('Play')),
GestureDetector(
onTap: () {
final _index = video.indexWhere((element) =>
element.name == complete[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList: _index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
onMyListTap: () async {
video.insert(0, complete[index]);
setState(() {});
await LocalStorage.addMovieToMyList(
complete[index]);
},
video: complete[index],
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: NewAndHotTileAction(
icon: Icons.info_outline,
label: 'Info',
),
),
],
),
Divider(
height: 30,
color: Colors.black,
),
BlocBuilder<ContinueWatchingBloc,
ContinueWatchingState>(builder: (context, state) {
if (state.listVideos.isNotEmpty) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(
left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Continue Watching",
style: TextStyle(
fontSize: 18,
fontWeight:
FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons
.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
int reversedIndex =
state.listVideos.length -
1 -
index;
final _index = video.indexWhere(
(element) =>
element.name ==
state
.listVideos[
reversedIndex]
.name);
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: url.toString(),
type: "Continue",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Continue Watching",
video: video,
),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding:
EdgeInsets.symmetric(horizontal: 10),
child: Row(
mainAxisSize: MainAxisSize.max,
children: List.generate(
state.listVideos.length, (index) {
int reversedIndex =
state.listVideos.length - 1 - index;
state.listVideos.reversed.toList();
var videos =
state.listVideos[reversedIndex];
return GestureDetector(
onTap: () {},
child: Container(
width: 110,
height: 170,
decoration: BoxDecoration(
color: Colors.grey[900],
borderRadius:
BorderRadius.circular(5),
),
margin: EdgeInsets.only(right: 8),
child: Column(
children: [
Expanded(
child: GestureDetector(
onTap: () {
final _index = video
.indexWhere((element) =>
element.name ==
state
.listVideos[
reversedIndex]
.name);
if (state
.listVideos[
reversedIndex]
.series ==
"not") {
Navigator.of(context, rootNavigator: true).push(MaterialPageRoute(
builder: (_) => MovieDetailPage(
videoModel: state.listVideos[reversedIndex],
title: state.listVideos[reversedIndex].name,
description: state.listVideos[reversedIndex].description,
cast: state.listVideos[reversedIndex].cast,
isExistFromMyList: _index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index]
.name);
video.removeAt(
_index);
setState(
() {});
},
onMyListTap: () async {
video.insert(
0,
complete[
index]);
setState(
() {});
await LocalStorage
.addMovieToMyList(
complete[
index]);
},
video: state.listVideos[reversedIndex].video,
trailer: state.listVideos[reversedIndex].trailer,
subtitle: state.listVideos[reversedIndex].subtitle,
img: state.listVideos[reversedIndex].image,
time: state.listVideos[reversedIndex].time,
token: tokenlink,
azure: azurelink,
age: state.listVideos[reversedIndex].age,
year: state.listVideos[reversedIndex].date,
genres: state.listVideos[reversedIndex].genres)));
} else {
Navigator.of(context,
rootNavigator:
true)
.push(
MaterialPageRoute(
builder: (_) =>
VideoDetailPage(
videoModel:
state.listVideos[
reversedIndex],
title: state
.listVideos[
reversedIndex]
.name,
description: state
.listVideos[
reversedIndex]
.description,
cast: state
.listVideos[
reversedIndex]
.cast,
isExistFromMyList:
_index !=
-1,
onRemove:
() async {
await LocalStorage.removeMovieFromMyList(
video[_index]
.name);
video.removeAt(
_index);
setState(
() {});
},
onMyListTap:
() async {
video.insert(
0,
complete[
index]);
setState(
() {});
await LocalStorage
.addMovieToMyList(
complete[index]);
},
seriess: state
.listVideos[
reversedIndex]
.seriess,
//seriess: test.testList,
img: state
.listVideos[
reversedIndex]
.image,
subtitle: state
.listVideos[
reversedIndex]
.subtitle,
token:
tokenlink,
azure:
azurelink,
trailer: state
.listVideos[reversedIndex]
.trailer,
video: state.listVideos[reversedIndex].video,
age: state.listVideos[reversedIndex].age,
year: state.listVideos[reversedIndex].date,
genres: state.listVideos[reversedIndex].genres),
),
);
}
},
child: ClipRRect(
borderRadius:
BorderRadius.only(
topRight:
Radius.circular(5),
topLeft:
Radius.circular(5),
),
child: Stack(
children: [
CachedNetworkImage(
imageUrl:
videos.image,
imageBuilder: (context,
imageProvider) =>
ClipRRect(
borderRadius: BorderRadius
.zero ??
BorderRadius
.circular(
8.0),
child: Image(
image:
imageProvider,
fit:
BoxFit.fill,
width: 110,
height: 110 +
(110 * .4),
),
),
placeholder:
(context,
url) =>
Shimmer(
gradient:
shimmerGradient,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius
.zero ??
BorderRadius.circular(
8.0),
color: Colors
.black),
width: 110 ??
(true ||
false
? double
.infinity
: 150.0),
height: 110 +
(110 *
.3) ??
(true ||
false
? 180.0
: 68.0)),
),
errorWidget:
(context, url,
error) =>
Container(
width: 110.0,
height: 220.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius
.circular(
8.0),
color: Colors
.grey),
child:
Image.asset(
'assets/images/logo.png',
),
),
),
GestureDetector(
onTap: () {},
child: Align(
alignment:
Alignment
.center,
child: Container(
width: 33,
height: 33,
decoration: BoxDecoration(
shape: BoxShape
.circle,
border: Border.all(
width:
2,
color: Colors
.white),
color: Colors
.black
.withOpacity(
0.4)),
child: Center(
child: Icon(
Icons
.play_arrow,
color: Colors
.white,
),
),
),
),
),
Container(
height: 500,
decoration:
BoxDecoration(
gradient:
LinearGradient(
colors: [
Colors.black87,
Colors
.transparent,
Colors
.transparent,
Colors
.transparent
],
begin: Alignment
.bottomCenter,
end: Alignment
.topCenter,
stops: [
0,
0.3,
0.6,
1
],
)),
child: Align(
alignment: Alignment
.bottomCenter,
child: videos
.series ==
"yes"
? Text(
"S${(videos.lastSeriesIndex ?? 0) + 1}:E${(videos.lastEpiIndex ?? 0) + 1}")
: Text('${(Duration(seconds: videos.startAt))}'
.split('.')[
0]
.padLeft(
6,
'0')),
),
),
],
),
),
),
),
LinearProgressIndicator(
minHeight: 2,
color: Colors.red,
value:
(videos.progress ?? 0) /
100,
),
SizedBox(
height: 40,
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
IconButton(
onPressed: () {
final _index = video
.indexWhere((element) =>
element
.name ==
state
.listVideos[
reversedIndex]
.name);
showModalBottomSheet(
context:
context,
useRootNavigator:
true,
backgroundColor:
Colors
.transparent,
builder: (_) =>
ShowVideoDetailMini(
isExistFromMyList:
_index !=
-1,
onRemove:
() async {
await LocalStorage.removeMovieFromMyList(
video[_index].name);
video.removeAt(
_index);
setState(
() {});
},
video: state
.listVideos[
reversedIndex],
onMyListTap:
() async {
video.insert(
0,
state.listVideos[reversedIndex]);
setState(
() {});
await LocalStorage.addMovieToMyList(
state.listVideos[reversedIndex]);
},
tokenLink:
tokenlink,
azurelink:
azurelink,
));
},
icon: Icon(
Icons
.info_outline,
color: Colors
.white)),
IconButton(
onPressed: () {
final _index = video
.indexWhere((element) =>
element
.name ==
state
.listVideos[
reversedIndex]
.name);
showModalBottomSheet(
context: context,
useRootNavigator:
true,
backgroundColor:
Colors
.transparent,
builder: (_) =>
ActionContnueWatchingBottom(
video: videos,
isExistFromMyList:
_index != -1,
onRemove:
() async {
await LocalStorage
.removeMovieFromMyList(
video[_index]
.name);
video.removeAt(
_index);
setState(() {});
},
onMyListTap:
() async {
video.insert(
0,
state.listVideos[
reversedIndex]);
setState(() {});
await LocalStorage
.addMovieToMyList(
state.listVideos[
reversedIndex]);
},
),
);
},
icon: Icon(
Icons
.more_vert_sharp,
color:
Colors.white),
)
],
),
)
],
),
),
);
}),
),
),
SizedBox(
height: 30,
),
]);
}
return Container();
}),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
video.length != 0
? Padding(
padding: const EdgeInsets.only(
left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"My List",
style: TextStyle(
fontSize: 18,
fontWeight:
FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons
.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: url.toString(),
type: "mylist",
tokenLink: tokenlink,
azurelink: azurelink,
title: "My List",
video: video,
),
),
);
}),
],
),
)
: Container(),
video.length != 0
? SizedBox(
height: 8,
)
: Container(),
video.length != 0
? SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: GestureDetector(
onTap: () {
// Navigator.push(context,
// MaterialPageRoute(builder: (_) => Streaming()));
},
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
video.length < 10
? video.length
: 10, (index) {
int reversedIndex =
video.length - 1 - index;
video.reversed.toList();
var videosc = video[reversedIndex];
// video.retainWhere((element) =>
// element.series[index] == "not");
// print(video
// .where((element) => element.series == 'not')
// .toList());
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
video[reversedIndex]
.name);
showModalBottomSheet(
context: context,
backgroundColor:
Colors.transparent,
builder: (_) =>
ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index]
.name);
video.removeAt(
_index);
setState(() {});
},
video: video[
reversedIndex],
onMyListTap:
() async {
video.insert(
0,
video[
reversedIndex]);
setState(() {});
await LocalStorage
.addMovieToMyList(
video[
reversedIndex]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: videosc.image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
child: Container(
margin: EdgeInsets.only(
right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius
.circular(6),
image: DecorationImage(
image:
imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) =>
Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(
right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius
.zero ??
BorderRadius
.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height:
110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget:
(context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
)
: Container(),
video.length != 0
? SizedBox(
height: 30,
)
: Container(),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Popular on Streamflix",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
popular[index].name);
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: urlpopular.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Popular on Streamflix",
video: video,
newvideo: popular,
),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: GestureDetector(
onTap: () {
// Navigator.push(context,
// MaterialPageRoute(builder: (_) => Streaming()));
},
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
popular.length < 10
? popular.length
: 10, (index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
popular[index].name);
showModalBottomSheet(
context: context,
backgroundColor:
Colors.transparent,
builder: (_) =>
ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index]
.name);
video.removeAt(_index);
setState(() {});
},
video: popular[index],
onMyListTap: () async {
video.insert(
0, popular[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
popular[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: popular[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) =>
Shimmer(
gradient: shimmerGradient,
child: Container(
margin:
EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius
.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"New Releases",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl:
urlnewreleases.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "New Releases",
video: video,
newvideo: newreleases),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
newreleases.length < 10
? newreleases.length
: 10, (index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
newreleases[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: newreleases[index],
onMyListTap: () async {
video.insert(
0, newreleases[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
newreleases[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: newreleases[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Hollywood Series",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl:
urltrending.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Hollywood Series",
video: video,
newvideo: trending),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: GestureDetector(
onTap: () {},
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
trending.length < 10
? trending.length
: 10, (index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
trending[index].name);
showModalBottomSheet(
context: context,
backgroundColor:
Colors.transparent,
builder: (_) =>
ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index]
.name);
video.removeAt(_index);
setState(() {});
},
video: trending[index],
onMyListTap: () async {
video.insert(
0, trending[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
trending[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: trending[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) =>
Shimmer(
gradient: shimmerGradient,
child: Container(
margin:
EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius
.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Only on Streamflix",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl:
urlcomplete.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Only on Streamflix",
video: video,
newvideo: complete),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: GestureDetector(
onTap: () {},
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
complete.length < 10
? complete.length
: 10, (index) {
int reverse = complete.length - 1 - index;
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
complete[reverse].name);
showModalBottomSheet(
context: context,
backgroundColor:
Colors.transparent,
builder: (_) =>
ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index]
.name);
video.removeAt(_index);
setState(() {});
},
video: complete[reverse],
onMyListTap: () async {
video.insert(
0, complete[reverse]);
setState(() {});
await LocalStorage
.addMovieToMyList(
complete[
reverse]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: complete[reverse].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 170,
height: 170 + (170 * .8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover)),
),
),
placeholder: (context, url) =>
Shimmer(
gradient: shimmerGradient,
child: Container(
margin:
EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius
.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 170 ??
(true || false
? double.infinity
: 150.0),
height: 170 + (170 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 170.0,
height: 330.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"US TV Shows",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl:
urlustvshows.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "US TV Shows",
video: video,
newvideo: ustvshows),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
ustvshows.length < 10
? ustvshows.length
: 10, (index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
ustvshows[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: ustvshows[index],
onMyListTap: () async {
video.insert(
0, ustvshows[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
ustvshows[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: ustvshows[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Anime",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: urlanime.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Anime",
video: video,
newvideo: anime),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
anime.length < 10 ? anime.length : 10,
(index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
anime[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: anime[index],
onMyListTap: () async {
video.insert(
0, anime[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
anime[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: anime[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Korean Drama",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: koreanlink.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Korean Drama",
video: video,
newvideo: korean),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
korean.length < 10 ? korean.length : 10,
(index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
korean[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: korean[index],
onMyListTap: () async {
video.insert(
0, korean[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
korean[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: korean[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Made in India",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl:
urlpopularbollywoodcrime
.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Made in India",
video: video,
newvideo:
popularbollywoodcrime),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
popularbollywoodcrime.length < 10
? popularbollywoodcrime.length
: 10, (index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
popularbollywoodcrime[index]
.name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: popularbollywoodcrime[
index],
onMyListTap: () async {
video.insert(
0,
popularbollywoodcrime[
index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
popularbollywoodcrime[
index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl:
popularbollywoodcrime[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Punjabi Drama",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: urlpunjabi.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Punjabi Drama",
video: video,
newvideo: punjabi,
),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
punjabi.length < 10 ? punjabi.length : 10,
(index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
punjabi[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: punjabi[index],
onMyListTap: () async {
video.insert(
0, punjabi[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
punjabi[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: punjabi[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"South Indian",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: urlcomplete.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "South",
video: video,
newvideo: south,
),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
south.length < 10 ? south.length : 10,
(index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
south[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: south[index],
onMyListTap: () async {
video.insert(
0, south[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
south[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: south[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Sci-Fi",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: urlcomplete.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Sci-Fi",
video: video,
newvideo: scifi,
),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
scifi.length < 10 ? scifi.length : 10,
(index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
scifi[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: scifi[index],
onMyListTap: () async {
video.insert(
0, scifi[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
scifi[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: scifi[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Action",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: urlcomplete.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Action",
video: video,
newvideo: action,
),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
action.length < 10 ? action.length : 10,
(index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
action[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: action[index],
onMyListTap: () async {
video.insert(
0, action[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
action[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: action[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Adventure",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: urlcomplete.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Adventure",
video: video,
newvideo: adventure,
),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
adventure.length < 10
? adventure.length
: 10, (index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
adventure[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: adventure[index],
onMyListTap: () async {
video.insert(
0, adventure[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
adventure[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: adventure[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Horror",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: urlcomplete.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Horror",
video: video,
newvideo: horror,
),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
horror.length < 10 ? horror.length : 10,
(index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
horror[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: horror[index],
onMyListTap: () async {
video.insert(
0, horror[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
horror[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: horror[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
Padding(
padding:
const EdgeInsets.only(left: 15, right: 15),
child: Row(
children: [
Expanded(
child: Row(
children: [
Text(
"Romantic",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
],
),
),
GestureDetector(
child: Icon(
Icons.keyboard_arrow_right_rounded,
color: Colors.white,
),
onTap: () {
Navigator.of(context,
rootNavigator: true)
.push(
MaterialPageRoute(
builder: (_) => Seeall(
videoUrl: urlcomplete.toString(),
type: "series",
tokenLink: tokenlink,
azurelink: azurelink,
title: "Romantic",
video: video,
newvideo: romantic,
),
),
);
}),
],
),
),
SizedBox(
height: 8,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Row(
children: List.generate(
romantic.length < 10
? romantic.length
: 10, (index) {
return GestureDetector(
onTap: () {
final _index = video.indexWhere(
(element) =>
element.name ==
romantic[index].name);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => ShowVideoDetailMini(
isExistFromMyList:
_index != -1,
onRemove: () async {
await LocalStorage
.removeMovieFromMyList(
video[_index].name);
video.removeAt(_index);
setState(() {});
},
video: romantic[index],
onMyListTap: () async {
video.insert(
0, romantic[index]);
setState(() {});
await LocalStorage
.addMovieToMyList(
romantic[index]);
},
tokenLink: tokenlink,
azurelink: azurelink,
));
},
child: CachedNetworkImage(
imageUrl: romantic[index].image,
imageBuilder:
(context, imageProvider) =>
ClipRRect(
borderRadius: BorderRadius.zero ??
BorderRadius.circular(8.0),
child: Container(
margin: EdgeInsets.only(right: 8),
width: 110,
height: 110 + (110 * .4),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(6),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.fill)),
),
),
placeholder: (context, url) => Shimmer(
gradient: shimmerGradient,
child: Container(
margin: EdgeInsets.only(right: 8),
decoration: BoxDecoration(
borderRadius:
BorderRadius.zero ??
BorderRadius.circular(
8.0),
color: Colors.black),
width: 110 ??
(true || false
? double.infinity
: 150.0),
height: 110 + (110 * .4) ??
(true || false
? 180.0
: 68.0)),
),
errorWidget: (context, url, error) =>
Container(
width: 110.0,
height: 155.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8.0),
color: Colors.grey),
child: Image.asset(
'assets/images/logo.png',
),
),
),
);
}),
),
),
),
SizedBox(
height: 30,
),
],
)
],
);
},
),
),
),
])),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment