banner_listtile 2.2.1
banner_listtile: ^2.2.1 copied to clipboard
Create tile with banner at the corner. This package allow you to make a custom Listtile with option to show or hide banner. Banner with "New" tag or something you want. And lot more.
example/lib/main.dart
import 'package:banner_listtile/banner_listtile.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
//debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData.light(),
home: const ContainerTestView(),
);
}
}
class ContainerTestView extends StatelessWidget {
const ContainerTestView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: const Text("Banner Listtile"),
),
body: Container(
padding: const EdgeInsets.all(10),
alignment: Alignment.topCenter,
width: width,
height: MediaQuery.of(context).size.height,
child: Column(
children: [
BannerListTile(
onTap: (){},
backgroundColor: Colors.blue,
borderRadius: BorderRadius.circular(8),
imageContainer: const Image(
image: NetworkImage(
"https://images.unsplash.com/photo-1529626455594-4ff0802cfb7e?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb1.2.1&auto=format&fit=crop&w=387&q=80"),
fit: BoxFit.cover),
title: const Text(
"Monalisa",
style: TextStyle(fontSize: 24, color: Colors.white),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
subtitle: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
IconButton(
onPressed: () {},
icon: const Icon(
Icons.facebook_outlined,
color: Colors.black87,
)),
IconButton(
onPressed: () {},
icon: const Icon(
Icons.location_on_outlined,
color: Colors.black87,
)),
IconButton(
onPressed: () {},
icon: const Icon(
Icons.phone,
color: Colors.black87,
)),
],
),
],
),
trailing: IconButton(
onPressed: () {},
icon: const Icon(
Icons.cancel,
color: Colors.red,
)),
),
const SizedBox(height: 4),
//
BannerListTile(
onTap: (){},
elevation: 8,
bannerPositionRight: true,
bannerColor: Colors.amber,
bannerTextColor: Colors.red,
bannerText: "Hot",
borderRadius: BorderRadius.circular(8),
imageContainer: const Image(
image: NetworkImage(
"https://images.unsplash.com/photo-1529626455594-4ff0802cfb7e?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb1.2.1&auto=format&fit=crop&w=387&q=80"),
fit: BoxFit.cover),
title: const Text(
"Lisa",
style: TextStyle(fontSize: 24, color: Colors.white),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
subtitle: const Text("A model from NY",
style: TextStyle(fontSize: 13, color: Colors.white)),
trailing: IconButton(
onPressed: () {},
icon: const Icon(
Icons.delete_forever,
color: Colors.red,
)),
),
//
const SizedBox(height: 4),
BannerListTile(
onTap: (){},
bannerPositionRight: false,
bannerColor: Colors.amber,
bannerText: "New Item",
bannerTextColor: Colors.red,
backgroundColor: Colors.blue,
borderRadius: BorderRadius.circular(8),
imageContainer: const Image(
image: NetworkImage(
"https://images.unsplash.com/photo-1529626455594-4ff0802cfb7e?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb1.2.1&auto=format&fit=crop&w=387&q=80"),
fit: BoxFit.cover),
title: const Text(
"Monalisa",
style: TextStyle(fontSize: 24, color: Colors.white),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
subtitle: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
IconButton(
onPressed: () {},
icon: const Icon(
Icons.facebook_outlined,
color: Colors.black87,
)),
IconButton(
onPressed: () {},
icon: const Icon(
Icons.location_on_outlined,
color: Colors.black87,
)),
IconButton(
onPressed: () {},
icon: const Icon(
Icons.phone,
color: Colors.black87,
)),
],
),
],
),
trailing: IconButton(
onPressed: () {},
icon: const Icon(
Icons.cancel,
color: Colors.red,
)),
),
const SizedBox(height: 4),
//
BannerListTile(
onTap: (){},
bannerText: "banner",
bannerPositionRight: false,
borderRadius: BorderRadius.circular(8),
imageContainer: const Image(
image: NetworkImage(
"https://images.unsplash.com/photo-1529626455594-4ff0802cfb7e?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb1.2.1&auto=format&fit=crop&w=387&q=80"),
fit: BoxFit.cover),
title: const Text(
"Lisa",
style: TextStyle(fontSize: 24, color: Colors.white),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
subtitle: const Text("A model from NY",
style: TextStyle(fontSize: 13, color: Colors.white)),
trailing: IconButton(
onPressed: () {},
icon: const Icon(
Icons.delete_forever,
color: Colors.red,
)),
),
//
const SizedBox(height: 4),
//
BannerListTile(
onTap: (){},
onLongPress: (){},
randomBackgroundColor: true,
showBanner: true,
bannerText: "Big banner",
subtitleOpacity: 1.0,
bannersize: 60,
bannerPositionRight: true,
borderRadius: BorderRadius.circular(8),
imageContainer: const Image(
image: NetworkImage(
"https://images.unsplash.com/photo-1529626455594-4ff0802cfb7e?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb1.2.1&auto=format&fit=crop&w=387&q=80"),
fit: BoxFit.cover),
title: const Text(
"Dummy Long Text",
style: TextStyle(fontSize: 24, color: Colors.white),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
subtitle: const Text("Lorem Ipsum is simply dummy text of the printing and typesetting industry. \nLorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \n\nIt has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
style: TextStyle(fontSize: 13, color: Colors.white)),
),
],
),
));
}
}