apptomate_custom_pageview 0.0.1
apptomate_custom_pageview: ^0.0.1 copied to clipboard
A highly customizable PageView widget with auto-scroll, navigation controls, and dot indicators for Flutter applications
example/lib/main.dart
import 'package:apptomate_custom_pageview/apptomate_custom_pageview.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const CustomPageViewWidget(),
);
}
}
class CustomPageViewWidget extends StatelessWidget {
const CustomPageViewWidget({super.key});
@override
Widget build(BuildContext context) {
final List<Widget> pages = [
_buildPage('Page 1', Colors.red),
_buildPage('Page 2', Colors.blue),
_buildPage('Page 3', Colors.green),
_buildPage('Page 4', Colors.orange),
];
return Scaffold(
appBar: AppBar(
title: const Text('Custom PageView'),
centerTitle: true,
),
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: CustomPageView(
pages: pages,
height: MediaQuery.of(context).size.height * 0.7,
isAutoScroll: true,
isShowDotIndicator: true,
isShowNextButtons: true,
autoScrollDuration: 4,
dotColor: Colors.grey,
activeDotColor: Colors.blue,
onPageChanged: (index) {
debugPrint('Page changed to: $index');
},
),
),
),
);
}
Widget _buildPage(String text, Color color) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(12.0),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
alignment: Alignment.center,
child: Text(
text,
style: const TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
);
}
}