🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Ramazan HABER / FLUTTER / introduction_screen uygulama tanıtımı image slider kullanımı

1-) FLUTTER - introduction_screen uygulama tanıtımı image slider kullanımı

 

paket : https://pub.dev/packages/introduction_screen/install

 

 

flutter pub add introduction_screen

flutter pub add shared_preferences

 

1- Main.dart

 

 

Future<void> main() async {
  
WidgetsFlutterBinding.ensureInitialized();
   
bool ilk = await introKontrol();
   runApp(
MyApp(ilk: ilk,));
}

 

Future<bool> introKontrol() async {
  
SharedPreferences prefs = await SharedPreferences.getInstance();
  
bool? gosterildi = prefs.getBool('gosterildi');

  
if (gosterildi==null || gosterildi==false) {
    
prefs.setBool('gosterildi', true);
    
return false;
  }
else {
    
return true;
  }
}

 

 

class MyApp extends StatefulWidget {
  
bool ilk=false;
  
MyApp({required this.ilk });

  
@override
  
State<MyApp> createState() => _MyAppState();
}

 

 

@override
Widget build(BuildContext context) {
  
return MaterialApp(
    title:
'Flutter Demo',
    debugShowCheckedModeBanner:
false,
    theme:
ThemeData.dark(),
    home:
widget.ilk==false ?MyIntroScreen():BottomNavigationPage(),
  );
}

 

 

 

 

2- MyIntroScreen.dart

import 'package:flutter/material.dart';
import 'package:introduction_screen/introduction_screen.dart';

import 'BottomNavigationPage.dart';

class MyIntroScreen extends StatefulWidget {
  
const MyIntroScreen({Key? key}) : super(key: key);

  
@override
  
State<MyIntroScreen> createState() => _MyIntroScreenState();
}

class _MyIntroScreenState extends State<MyIntroScreen> {


  
@override
  
void initState() {
    
super.initState();
  }

  
final List<PageViewModel> pages = [
    
PageViewModel(
      title:
"Hoş Geldiniz",
      body:
"Uygulamanın harika özelliklerini keşfetmeye hazır mısınız?",
      image:
Image.asset('assets/images/1.png'), // Kendi görselinizi ekleyin
    
),
    
PageViewModel(
      title:
"Özellikler",
      body:
"Uygulamanın birçok harika özelliği var.",
      image:
Image.asset('assets/images/2.png'), // Kendi görselinizi ekleyin
    
),
    
PageViewModel(
      title:
"Başlayalım",
      body:
"Şimdi başlamak için hazırsınız. İyi eğlenceler!",
      image:
Image.asset('assets/images/3.png'), // Kendi görselinizi ekleyin
    
),
  ];

  
@override
  
Widget build(BuildContext context) {
    
return MaterialApp(
      home:
SafeArea(

        child:
Container(
          child:
IntroductionScreen(
            pages:
pages,
            onDone: () {
              
// Intro tamamlandığında yapılacak işlemler
              // Örneğin, ana sayfaya yönlendirme yapabilirsiniz.
              
Navigator.of(context).pushReplacement(MaterialPageRoute(
                builder: (context) =>
BottomNavigationPage(),
              ));
            },
            showSkipButton:
true,
            showNextButton:
false, // Sonraki düğmesini gizlemek için
            
skip: const Text("Atla"),
            done:
const Text("Tamamla"),
          ),
        ),
      ),
    );
  }
}


 

 

 

 

 2023 Ekim 16 Pazartesi
 256