Skip to content

Commit

Permalink
Change Carousel in Foodies Behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
bagussubagja committed Dec 21, 2022
1 parent 69447e6 commit f5b230d
Showing 1 changed file with 71 additions and 61 deletions.
132 changes: 71 additions & 61 deletions lib/screens/main_features_screens/foodies/foodies_main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,75 +127,85 @@ class _FoodiesScreenState extends State<FoodiesScreen> {
return CarouselSlider.builder(
itemCount: 3,
itemBuilder: (context, index, realIndex) {
return ClipRRect(
return InkWell(
borderRadius: BorderRadius.circular(12),
child: Container(
color: greyColor,
child: Stack(
fit: StackFit.expand,
children: [
ClipRRect(
child: CachedNetworkImage(
imageUrl: item?.thumbnail[index] ?? _placeHolder,
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
onTap: () async {
final url =
Uri.parse(itemCarousel.carousel![0].link[index].toString());
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
},
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Container(
color: greyColor,
child: Stack(
fit: StackFit.expand,
children: [
ClipRRect(
child: CachedNetworkImage(
imageUrl: item?.thumbnail[index] ?? _placeHolder,
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
),
),
),
),
placeholder: (context, url) => const Center(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) => const Center(
child: Icon(Icons.error),
placeholder: (context, url) => const Center(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) => const Center(
child: Icon(Icons.error),
),
),
),
),
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
Colors.black,
greyColor.withOpacity(0.1),
],
)),
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${item?.title[index].substring(0, 45)}..",
style: regularStyle.copyWith(color: whiteColor),
),
GestureDetector(
onTap: () async {
final url = Uri.parse(itemCarousel
.carousel![0].link[index]
.toString());
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
},
child: Text(
"Baca Selengkapnya",
style: regularStyle.copyWith(
color: greyTextColor, fontSize: 13),
),
),
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
Colors.black,
greyColor.withOpacity(0.1),
],
)),
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${item?.title[index].substring(0, 45)}..",
style: regularStyle.copyWith(color: whiteColor),
),
InkWell(
onTap: () async {
final url = Uri.parse(itemCarousel
.carousel![0].link[index]
.toString());
if (await canLaunchUrl(url)) {
await launchUrl(url);
}
},
child: Text(
"Baca Selengkapnya",
style: regularStyle.copyWith(
color: greyTextColor, fontSize: 13),
),
),
],
),
),
),
),
],
],
),
),
),
);
Expand Down

0 comments on commit f5b230d

Please sign in to comment.