Search
 
SCRIPT & CODE EXAMPLE
 

DART

add a button that changes the text in flutter

class MyClass extends StatefulWidget {
  @override
  _MyClassState createState() => _MyClassState();
}

class _MyClassState extends State<MyClass> {
  bool pressGeoON = false;
  bool cmbscritta = false;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: RaisedButton(
          shape: new RoundedRectangleBorder(
              borderRadius: new BorderRadius.circular(18.0),
              side: BorderSide(color: Colors.red)),
          color: pressGeoON ? Colors.blue : Colors.red,
          textColor: Colors.white,
          child: cmbscritta ? Text("GeoOn") : Text("GeoOFF"),
          //    style: TextStyle(fontSize: 14)
            onPressed: () {
              setState(() {
                pressGeoON = !pressGeoON;
                cmbscritta = !cmbscritta;
              });
            }
        ),
      ),
    );
  }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: flutter text in row not wrapping 
Dart :: flutter tabbar 
Dart :: list join dart 
Dart :: strapi starters 
Dart :: inkwell splash color not working flutter 
Dart :: dart exit function 
Dart :: how to hide the keyboard in flutter 
Dart :: how to get real time data flutter 
Dart :: dart get class name 
Dart :: flutter map 
Dart :: How to i convert this python code to dart? 
Dart :: onpressed null flutter 
Dart :: flutter add checkbox 
Dart :: Flutter local asset run time path 
Dart :: flutter dollar sign interpolation 
Dart :: extension methods in dart 
Dart :: how to perform a text search over json data in flutter 
Dart :: How to call a method on the State Notifier Provider 
Dart :: Should I learn Dart for Flutter? 
Swift :: swift self.present full screen 
Swift :: swift continue 
Swift :: swift pop to specific view controller 
Swift :: gap between table header uitableview 
Swift :: pop the view controller xcode 
Swift :: return multiple values from a function swift 
Swift :: add corner radius to uiview swift 
Swift :: swift dispatch queue 
Swift :: sort array alphabetically swift 4 
Swift :: hex color extension swift 
Swift :: swift dictionary contains key 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =