Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 3.24 KB | None | 0 0
  1.  ```   return Dialog(
  2.       backgroundColor: Colors.white,
  3.       shape: RoundedRectangleBorder(
  4.           borderRadius: BorderRadius.all(Radius.circular(16.0))),
  5.       child: Container(
  6.         padding: EdgeInsets.all(16.0),
  7.         child: Stack(
  8.           children: <Widget>[
  9.             Container(
  10.               foregroundDecoration: _loading
  11.                   ? BoxDecoration(
  12.                       color: Colors.white.withOpacity(0.5),
  13.                     )
  14.                   : null,
  15.               child: Column(
  16.                 mainAxisSize: MainAxisSize.min,
  17.                 children: <Widget>[
  18.                   TextField(
  19.                     controller: _controller,
  20.                     decoration: InputDecoration(
  21.                       border: OutlineInputBorder(),
  22.                       labelText: 'New assignment',
  23.                       labelStyle: TextStyle(
  24.                         fontSize: 16.0,
  25.                         fontWeight: FontWeight.w500,
  26.                       ),
  27.                       errorText: _valid ? null : 'Name your assignment first',
  28.                       errorStyle: TextStyle(
  29.                         fontSize: 12.0,
  30.                         fontWeight: FontWeight.w500,
  31.                       ),
  32.                     ),
  33.                     autocorrect: true,
  34.                     autofocus: true,
  35.                     textCapitalization: TextCapitalization.words,
  36.                   ),
  37.                   SizedBox(height: 10.0),
  38.                   Row(
  39.                     children: <Widget>[
  40.                       DialogButton(
  41.                         icon: Icons.camera,
  42.                         onTap: () async {
  43.                           if (_controller.text.isEmpty) {
  44.                             return setState(() {
  45.                               _valid = false;
  46.                             });
  47.                           }
  48.                           final cameras = await availableCameras();
  49.                           Navigator.of(context).push(MaterialPageRoute(
  50.                               builder: (context) => CameraScreen(
  51.                                     onTaken: uploadFile,
  52.                                     camera: cameras.first,
  53.                                   )));
  54.                         },
  55.                         label: 'Take a photo',
  56.                       ),
  57.                       SizedBox(width: 10.0),
  58.                       DialogButton(
  59.                         icon: Icons.insert_drive_file,
  60.                         onTap: () async {
  61.                           if (_controller.text.isEmpty) {
  62.                             return setState(() {
  63.                               _valid = false;
  64.                             });
  65.                           }
  66.                           File file = await FilePicker.getFile();
  67.                           uploadFile(file);
  68.                         },
  69.                         label: 'Upload a file',
  70.                       ),
  71.                     ],
  72.                   ),
  73.                 ],
  74.               ),
  75.             ),
  76.             _loading
  77.                 ? Center(
  78.                     child: CircularProgressIndicator(),
  79.                   )
  80.                 : Container(height: 0.0, width: 0.0),
  81.           ],
  82.         ),
  83.       ),
  84.     );
  85. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement