GestureDetector not working for a flipping animation of a square

23 Views Asked by At

i have a problem is that i build a widget using the Transform which is wrapped by a GestureDetector that reacts when i tap and flips. But idk why is not working. This is what i have on the screen

enter image description here


import 'package:flutter/material.dart';

class LoginScreenView extends StatelessWidget {
  late TextEditingController _controller;
  LoginScreenView({super.key}) {
    this._controller = TextEditingController();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.cyan,
      body: SafeArea(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [``your text``
            const SizedBox(
              height: 100,
            ),
            Container(
              alignment: Alignment.center,
              width: 100,
              color: Colors.white,
              child: TextField(
                controller: _controller,
                onChanged: (value) => print(_controller.text),
                decoration: const InputDecoration(
                  hintText: "Username",
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

`

1

There are 1 best solutions below

1
yarden On

You should change it from stateless widget to statefull or else it wont be able to animate or detect gestures