Designing the mobile app to implement Gestures

  import 'package:flutter/material.dart';

 void main() {

 runApp(MaterialApp(home: MyApp()));

 class MyApp extends StatefulWidget {

 const MyApp({Key? key}) : super(key: key);

 @override

 _MyAppState createState() => _MyAppState();

 class _MyAppState extends State<MyApp> {

 int numberOfTimesTapped = 0;

 @override

 Widget build(BuildContext context) {  return Scaffold(  body: Center(

 child: Column(

 mainAxisAlignment: MainAxisAlignment.spaceEvenly,  children: [

 Text(

 'Tapped ' + numberOfTimesTapped.toString() + ' times ',  style: TextStyle(fontSize: 30),

 ),

 GestureDetector(  onTap: () {

 setState(() {

 numberOfTimesTapped++;

 });

 },

 child: Container(

 padding: EdgeInsets.all(20),  color: Colors.green[200],  child: Text(  'TAP HERE',  style: TextStyle(fontSize: 30),

 ),

 ),

 ),

] ,

) ,

) ,

) ;

Comments

Popular posts from this blog

Designing the mobile app to implement different Layouts

Designing the mobile app to implement the state management.