Last active
April 18, 2023 12:32
-
-
Save Akhu/946c1bfb366e88667bc6a73d9c4bbfde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
static const String _title = 'Flutter - Basics'; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: _title, | |
home: Scaffold( | |
body: const OnboardingPager(), | |
), | |
); | |
} | |
} | |
class OnboardingPager extends StatelessWidget { | |
const OnboardingPager({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
final PageController controller = PageController(); | |
return ScrollConfiguration( | |
behavior: ScrollConfiguration.of(context).copyWith( | |
dragDevices: { | |
PointerDeviceKind.touch, | |
PointerDeviceKind.mouse, | |
}, | |
), | |
child: Container( | |
color: const Color.fromARGB(255, 240, 239, 235), | |
child: PageView( | |
controller: controller, | |
children: const <Widget>[ | |
Center( | |
child: Text('First Page'), | |
), | |
Center( | |
child: Text('Second Page'), | |
), | |
Center( | |
child: Text('Third Page'), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment