Monday, June 13, 2022

Gesture Detector

  Gesture Detector


import 'package:flutter/material.dart';

void main(){
runApp(MyApp());
}

class MyApp extends StatelessWidget{
bool change=false;
  @override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
       appBar: AppBar(
title: Text("Gesture Widget"),
backgroundColor: Colors.purple.withOpacity(.50),
),
       body: Container(
constraints: const BoxConstraints.expand(), decoration: BoxDecoration( border: Border.all( color: Colors.transparent, ), ), child: Column( //crossAxisAlignment: CrossAxisAlignment.center, //mainAxisAlignment: MainAxisAlignment.start, children: [ Container( decoration: BoxDecoration( border: Border.all( color: Colors.transparent, ), ), child: GestureDetector( child: Container( color: change ? Colors.pink : Colors.green, width: 100, height: 100, ), onTap:(){ setState((){ change=!change; }); }, ), ), ], ), ),
     ),
);    ðŸ’ª // MaterialApp
}

}

No comments:

Post a Comment

Featured post

Compress Image With Show File Size & Resolution in Flutter

 Compress Image With Show File Size & Resolution  1.Multiple File Image Compress with file Size import 'dart:io' ; import 'p...

LightBlog