Jaagdish47

7.Designing the mobile app to implement Gestures.

Nov 24th, 2024
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.19 KB | Source Code | 0 0
  1. //7.Designing the mobile app to implement Gestures.
  2. import 'package:flutter/material.dart';
  3.  
  4. void main() {
  5.   runApp(MaterialApp(home: const MyApp()));
  6. }
  7.  
  8. class MyApp extends StatefulWidget {
  9.   const MyApp({Key? key}) : super(key: key);
  10.   @override
  11.   State<MyApp> createState() => _MyAppState();
  12. }
  13.  
  14. class _MyAppState extends State<MyApp> {
  15.   int numberOfTimesTapped = 0;
  16.   @override
  17.   Widget build(BuildContext context) {
  18.     return Scaffold(
  19.       body: Center(
  20.         child: Column(
  21.           mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  22.           children: [
  23.             Text('Tapped ' + numberOfTimesTapped.toString() + 'times',
  24.                 style: TextStyle(fontSize: 30)),
  25.             GestureDetector(
  26.               onTap: () {
  27.                 setState(() {
  28.                   numberOfTimesTapped++;
  29.                 });
  30.               },
  31.               child: Container(
  32.                   padding: EdgeInsets.all(20),
  33.                   color: Colors.green[200],
  34.                   child: Text(
  35.                     'TAP HERE',
  36.                     style: TextStyle(fontSize: 30),
  37.                   )),
  38.             )
  39.           ],
  40.         ),
  41.       ),
  42.     );
  43.   }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment