card_banner 0.0.1 copy "card_banner: ^0.0.1" to clipboard
card_banner: ^0.0.1 copied to clipboard

A simple widget that helps you place a banner on any widget.

example/lib/main.dart

import 'package:card_banner/card_banner.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Card Banner',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyBanner(),
    );
  }
}

class MyBanner extends StatelessWidget {
  const MyBanner({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color.fromARGB(255, 221, 222, 245),
      body: ListView.builder(
        padding: const EdgeInsets.symmetric(horizontal: 10),
        itemCount: 8,
        itemBuilder: (context, index) {
          return CardBanner(
            text: "50% Off",
            child: foodCard(),
          );
        },
      ),
    );
  }

  Card foodCard() {
    return Card(
      child: ListTile(
        contentPadding: EdgeInsets.zero,
        title: Image.network(
          "https://images.pexels.com/photos/842571/pexels-photo-842571.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2",
          height: 200,
          fit: BoxFit.cover,
        ),
        subtitle: const Padding(
          padding: EdgeInsets.all(12.0),
          child: Text(
            "Nulla cillum qui elit adipisicing culpa ad laboris amet laboris velit. Pariatur sit tempor nostrud non duis commodo laboris. Consequat incididunt laborum qui dolore in velit consequat mollit amet. Proident eu et sint veniam sunt fugiat quis fugiat sunt pariatur do enim in.Qui proident veniam aute commodo consectetur id ipsum. Laborum occaecat enim cupidatat deserunt et reprehenderit tempor ipsum elit. Proident enim ullamco aliqua veniam cupidatat mollit voluptate dolore Lorem adipisicing velit. Culpa magna occaecat ipsum ea aliquip in quis sunt cillum ad deserunt nostrud ex non.",
            overflow: TextOverflow.ellipsis,
            maxLines: 3,
          ),
        ),
      ),
    );
  }
}
25
likes
150
pub points
84%
popularity

Publisher

unverified uploader

A simple widget that helps you place a banner on any widget.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on card_banner