Protótipo Vilacorp
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:decpisos/videos/youtube_video_player.dart';
|
||||
import 'package:vilacorp/videos/youtube_video_player.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -53,18 +53,18 @@ import 'bloc/youtube_controller.dart';
|
||||
// Text("Não há mais Vídeos para exibir."),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// return Center(child: Padding(
|
||||
// padding: const EdgeInsets.only(top: 8.0),
|
||||
// child: Text("Não há mais Vídeos para exibir."),
|
||||
// ),);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// )),
|
||||
// )),
|
||||
// );
|
||||
// }
|
||||
|
||||
@@ -102,7 +102,7 @@ import 'bloc/youtube_controller.dart';
|
||||
// // fullScreen: true //default false
|
||||
// // );
|
||||
// // },
|
||||
// // )
|
||||
// // )
|
||||
// ],
|
||||
// ),
|
||||
// ));
|
||||
@@ -168,7 +168,7 @@ import 'bloc/youtube_controller.dart';
|
||||
// RaisedButton(onPressed: c.refresh, child: Text('Atualizar'),)
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
class YouTubeVideosScreen extends StatefulWidget {
|
||||
@@ -176,8 +176,8 @@ class YouTubeVideosScreen extends StatefulWidget {
|
||||
_YouTubeVideosScreenState createState() => _YouTubeVideosScreenState();
|
||||
}
|
||||
|
||||
class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with AutomaticKeepAliveClientMixin<YouTubeVideosScreen> {
|
||||
|
||||
class _YouTubeVideosScreenState extends State<YouTubeVideosScreen>
|
||||
with AutomaticKeepAliveClientMixin<YouTubeVideosScreen> {
|
||||
final YouTubeController c = Get.put(YouTubeController());
|
||||
|
||||
@override
|
||||
@@ -195,66 +195,74 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
|
||||
appBar: AppBar(
|
||||
title: Text('Vídeos'),
|
||||
),
|
||||
body: Obx(() => c.loading.value ? Center(child: CircularProgressIndicator(),) : c.errorCode.value != 0 ? this._buildError() : RefreshIndicator(
|
||||
onRefresh: c.refresh,
|
||||
child: AnimationLimiter(
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
itemCount: c.itens.length + 1,
|
||||
itemBuilder: (_,index){
|
||||
if (index < c.itens.length) {
|
||||
var item = c.itens[index];
|
||||
return AnimationConfiguration.staggeredList(
|
||||
position: index,
|
||||
duration: const Duration(milliseconds: 375),
|
||||
child: SlideAnimation(
|
||||
verticalOffset: 30.0,
|
||||
child: FadeInAnimation(
|
||||
child: listItem(item),
|
||||
)
|
||||
)
|
||||
);
|
||||
// return SlideTransition(
|
||||
// position: c.animation,
|
||||
// child: this._buildListTile(index)
|
||||
// );
|
||||
} else if (index > 1) {
|
||||
if (!GetUtils.isNullOrBlank(c.results.value.nextPageToken)!) {
|
||||
c.getChannelVideosBloc();
|
||||
return Center(child: CircularProgressIndicator(),);
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0,bottom: 25.0),
|
||||
child:
|
||||
Text("Não há mais Vídeos para exibir."),
|
||||
body: Obx(() => c.loading.value
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: c.errorCode.value != 0
|
||||
? this._buildError()
|
||||
: RefreshIndicator(
|
||||
onRefresh: c.refresh,
|
||||
child: AnimationLimiter(
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
itemCount: c.itens.length + 1,
|
||||
itemBuilder: (_, index) {
|
||||
if (index < c.itens.length) {
|
||||
var item = c.itens[index];
|
||||
return AnimationConfiguration.staggeredList(
|
||||
position: index,
|
||||
duration: const Duration(milliseconds: 375),
|
||||
child: SlideAnimation(
|
||||
verticalOffset: 30.0,
|
||||
child: FadeInAnimation(
|
||||
child: listItem(item),
|
||||
)));
|
||||
// return SlideTransition(
|
||||
// position: c.animation,
|
||||
// child: this._buildListTile(index)
|
||||
// );
|
||||
} else if (index > 1) {
|
||||
if (!GetUtils.isNullOrBlank(
|
||||
c.results.value.nextPageToken)!) {
|
||||
c.getChannelVideosBloc();
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 8.0, bottom: 25.0),
|
||||
child: Text("Não há mais Vídeos para exibir."),
|
||||
),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text("Não há mais Vídeos para exibir."),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return Center(child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text("Não há mais Vídeos para exibir."),
|
||||
),);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget listItem(YouTubeItems item) {
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
if(GetUtils.isNullOrBlank(item.id!.videoId)!){
|
||||
onTap: () {
|
||||
if (GetUtils.isNullOrBlank(item.id!.videoId)!) {
|
||||
Get.rawSnackbar(message: 'Não foi possível reproduzir o vídeo');
|
||||
} else {
|
||||
Get.to(() => YouTubeVideoPlayerScreen(
|
||||
ytVideo: item,
|
||||
));
|
||||
}
|
||||
else{
|
||||
Get.to(() => YouTubeVideoPlayerScreen(ytVideo: item,));
|
||||
}
|
||||
|
||||
},
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
@@ -266,7 +274,7 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
|
||||
LimitedBox(
|
||||
maxHeight: 100.0,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 4/3,
|
||||
aspectRatio: 4 / 3,
|
||||
child: FadeInImage.memoryNetwork(
|
||||
placeholder: kTransparentImage,
|
||||
image: item.snippet?.thumbnails?.thumbDefault?.url ?? '',
|
||||
@@ -284,21 +292,24 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
|
||||
item.snippet!.title!,
|
||||
softWrap: true,
|
||||
maxLines: 2,
|
||||
style: TextStyle(fontSize: 13.0,fontWeight: FontWeight.bold),
|
||||
style: TextStyle(
|
||||
fontSize: 13.0, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Padding(padding: EdgeInsets.only(bottom: 1.5)),
|
||||
Text(
|
||||
item.snippet!.description!,
|
||||
softWrap: true,
|
||||
maxLines: 3,
|
||||
style: TextStyle(fontSize: 11.0,fontWeight: FontWeight.w400),
|
||||
style: TextStyle(
|
||||
fontSize: 11.0, fontWeight: FontWeight.w400),
|
||||
),
|
||||
Padding(padding: EdgeInsets.only(bottom: 3.0)),
|
||||
Text(
|
||||
c.getDateFormatada(item.snippet!.publishedAt!),
|
||||
softWrap: true,
|
||||
maxLines: 1,
|
||||
style: TextStyle(fontSize: 9.0,fontWeight: FontWeight.w300),
|
||||
style:
|
||||
TextStyle(fontSize: 9.0, fontWeight: FontWeight.w300),
|
||||
),
|
||||
]))
|
||||
],
|
||||
@@ -308,7 +319,7 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildError(){
|
||||
Widget _buildError() {
|
||||
return Container(
|
||||
width: double.maxFinite,
|
||||
child: Column(
|
||||
@@ -321,5 +332,5 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user