custom_banners 1.0.1 custom_banners: ^1.0.1 copied to clipboard
New Custom Banners for every project flutter,Designed to display advertising type notices receiving a link and image bannerModel
example/custom_banners_example.dart
import 'dart:convert';
import 'package:custom_banners/src/ui/custom_banners_base.dart';
import 'package:custom_banners/src/model/banner_model.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, this.title}) : super(key: key);
final String? title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<BannerModel> listBanners = [
BannerModel(
link:
'https://post.medicalnewstoday.com/wp-content/uploads/sites/3/2020/02/322868_1100-800x825.jpg',
image:
'https://post.medicalnewstoday.com/wp-content/uploads/sites/3/2020/02/322868_1100-800x825.jpg'),
BannerModel(
link:
'https://i.pinimg.com/originals/9b/a2/55/9ba255be1da51f06de7b3f18da99fc44.jpg',
image:
'https://i.pinimg.com/originals/9b/a2/55/9ba255be1da51f06de7b3f18da99fc44.jpg')
];
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title!),
),
body: SingleChildScrollView(
child: Column(children: [
CustomBannersBase(
listBanners: listBanners,
)
]),
),
);
}
}