foto_gallery 2.0.0 foto_gallery: ^2.0.0 copied to clipboard
Foto gallery package will help you to create reactive image slider.
import 'package:flutter/material.dart';
import 'package:foto_gallery/app/ui/pages/foto_gallery_page.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<String> imageList = [
"https://images.pexels.com/photos/733853/pexels-photo-733853.jpeg",
"https://images.pexels.com/photos/2899097/pexels-photo-2899097.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
"https://images.pexels.com/photos/2820884/pexels-photo-2820884.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: ListView.builder(
itemCount: imageList.length,
itemBuilder: ((context, index) {
return Container(
height: 300,
width: double.infinity,
padding: const EdgeInsets.all(30),
child: ClipRRect(
borderRadius: BorderRadius.circular(30),
child: FotoGallery(
image: imageList[index],
imageList: imageList,
imgurl: imageList[index],
index: index,
fit: BoxFit.cover,
),
),
);
}),
),
);
}
}