import 'package:flutter/material.dart';
class Home extends StatefulWidget {
const Home({Key? key}) : super(key: key);
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
int currentPageIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Page Slider'),
),
body: PageView.builder(
itemCount: 3, // عدد الصفحات
onPageChanged: (index) {
setState(() {
currentPageIndex = index;
});
},
itemBuilder: (BuildContext context, int index) {
return Center(
child: Text(
'Page ${index + 1}',
style: TextStyle(fontSize: 24.0),
),
);
},
),
);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter