Last active
          December 10, 2021 01:37 
        
      - 
      
 - 
        
Save jonahwilliams/26b63c58efd8e899bd3495047864cea3 to your computer and use it in GitHub Desktop.  
    Material changing
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'package:flutter/material.dart'; | |
| void main() => runApp(new MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return new MaterialApp( | |
| title: 'Flutter Demo', | |
| theme: new ThemeData( | |
| primarySwatch: Colors.blue, | |
| ), | |
| home: new MyHomePage(), | |
| ); | |
| } | |
| } | |
| class MyHomePage extends StatefulWidget { | |
| @override | |
| _MyHomePageState createState() => new _MyHomePageState(); | |
| } | |
| class _MyHomePageState extends State<MyHomePage> { | |
| final _controller = new TextEditingController(); | |
| bool _showController = false; | |
| Color _color = Colors.red; | |
| void _toggleController() { | |
| setState(() { | |
| _showController = !_showController; | |
| }); | |
| } | |
| @override | |
| Widget build(BuildContext context) { | |
| return new Scaffold( | |
| body: new Center( | |
| child: new Container( | |
| width: 200.0, | |
| height: 200.0, | |
| child: new Material( | |
| shadowColor: _color, | |
| elevation: 8.0, | |
| child: _showController ? new TextField(controller: _controller) : new Container(), | |
| ), | |
| ), | |
| ), | |
| floatingActionButton: new FloatingActionButton( | |
| onPressed: _toggleController, | |
| tooltip: 'Increment', | |
| child: new Icon(Icons.add), | |
| ), | |
| ); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment