Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //7.Designing the mobile app to implement Gestures.
- import 'package:flutter/material.dart';
- void main() {
- runApp(MaterialApp(home: const MyApp()));
- }
- class MyApp extends StatefulWidget {
- const MyApp({Key? key}) : super(key: key);
- @override
- State<MyApp> 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),
- )),
- )
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment