import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
@override
_HomePage createState() => _HomePage();
}
class _HomePage extends State<HomePage> {
var text = 'test';
bool isSelect= false;
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Column(
children: [
GestureDetector(
onTap: (){
if(isSelect == false){
setState(() {
isSelect= true;
});
}else{
setState(() {
isSelect = false;
});
}
},
child: isSelect == false ? Center(child: Text(text,style: const TextStyle(fontSize: 50,fontWeight: FontWeight.bold),)): isSelect == true ? Center(child: Text(text,style: const TextStyle(decoration: TextDecoration.underline,fontSize: 50,fontWeight: FontWeight.bold,color: Colors.red),)):Text('')),
],
),
),
);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.