Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ``` return Dialog(
- backgroundColor: Colors.white,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.all(Radius.circular(16.0))),
- child: Container(
- padding: EdgeInsets.all(16.0),
- child: Stack(
- children: <Widget>[
- Container(
- foregroundDecoration: _loading
- ? BoxDecoration(
- color: Colors.white.withOpacity(0.5),
- )
- : null,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: <Widget>[
- TextField(
- controller: _controller,
- decoration: InputDecoration(
- border: OutlineInputBorder(),
- labelText: 'New assignment',
- labelStyle: TextStyle(
- fontSize: 16.0,
- fontWeight: FontWeight.w500,
- ),
- errorText: _valid ? null : 'Name your assignment first',
- errorStyle: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.w500,
- ),
- ),
- autocorrect: true,
- autofocus: true,
- textCapitalization: TextCapitalization.words,
- ),
- SizedBox(height: 10.0),
- Row(
- children: <Widget>[
- DialogButton(
- icon: Icons.camera,
- onTap: () async {
- if (_controller.text.isEmpty) {
- return setState(() {
- _valid = false;
- });
- }
- final cameras = await availableCameras();
- Navigator.of(context).push(MaterialPageRoute(
- builder: (context) => CameraScreen(
- onTaken: uploadFile,
- camera: cameras.first,
- )));
- },
- label: 'Take a photo',
- ),
- SizedBox(width: 10.0),
- DialogButton(
- icon: Icons.insert_drive_file,
- onTap: () async {
- if (_controller.text.isEmpty) {
- return setState(() {
- _valid = false;
- });
- }
- File file = await FilePicker.getFile();
- uploadFile(file);
- },
- label: 'Upload a file',
- ),
- ],
- ),
- ],
- ),
- ),
- _loading
- ? Center(
- child: CircularProgressIndicator(),
- )
- : Container(height: 0.0, width: 0.0),
- ],
- ),
- ),
- );
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement