Beginning FlutterFire

Aug 30 2022 · Dart 2.16, Flutter 3.0, Visual Studio Code 1.69

Part 3: Read & Write Data with the Cloud Firestore

13. Create the Activity Detail Screen

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 12. Create the Activities Screen Next episode: 14. Add & Update Data into the Firestore Database

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Now you will create the screen that allows users to insert a new activity and update an existing one.

ActivityScreen(this.activity, {Key? key}) : super(key: key); 
  final Activity activity; 
final TextEditingController txtDescription = TextEditingController(); 
final TextEditingController txtDay = TextEditingController(); 
final TextEditingController txtBeginTime = TextEditingController(); 
final TextEditingController txtEndTime = TextEditingController(); 
final helper = FirebaseHelper(); 
class ActivityTextField extends StatelessWidget { 
  const ActivityTextField(this.label, this.controller, {Key? key}) 
      : super(key: key); 
  final String label; 
  final TextEditingController controller; 

  @override 
  Widget build(BuildContext context) { 
    return Padding( 
      padding: const EdgeInsets.all(16.0), 
      child: TextField( 
        controller: controller, 
        decoration: InputDecoration( 
            border: const OutlineInputBorder(), 
            hintText: label, 
            labelText: label), 
      ), 
    ); 
  } 
} 
List<ActivityTextField> controls = []; 
controls = [ 
      ActivityTextField('Description', txtDescription), 
      ActivityTextField('Date', txtDay), 
      ActivityTextField('Begin', txtBeginTime), 
      ActivityTextField('End', txtEndTime), 
    ]; 
txtDescription.text = widget.activity.description; 
txtDay.text = widget.activity.day; 
txtBeginTime.text = widget.activity.beginTime; 
txtEndTime.text = widget.activity.endTime; 
ListView.builder( 
  itemCount: controls.length, 
  itemBuilder: (context, position) { 
    return Card( 
      child: controls[position], 
    ); 
  }),