Dart: Event at Container

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
  print('test');
}

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

  void _incrementCounter() {
    print(DateTime.now());
  }

  @override
  Widget build(BuildContext context) {

    return Directionality(
        textDirection: TextDirection.ltr,

        child: Column(children: [

          GestureDetector( // Event at Container
              onTap: () {
                _incrementCounter();
              },
              child: Container(
                child: const Text('hello'),
                height: 100,
                width: 200,
                color: Colors.amber,
              ))
        ]));
  }
}

TagTimes

Simple time tracking tool
Developed by Namu Works