إنشاء عرض صفحات

PHOTO EMBED

Sun Feb 18 2024 20:31:49 GMT+0000 (Coordinated Universal Time)

Saved by @mebean

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),
            ),
          );
        },
      ),

    );
  }
}
content_copyCOPY

https://chat.openai.com/