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

Take your career further with a raywenderlich.com Pro subscription. 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.

Create the Activity Detail Screen Pro

This video was last updated on Aug 30 2022

In this lesson you will create the Activity Detail screen that allows users to insert a new activity and update an existing one.

Contributors

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a raywenderlich.com Professional subscription.

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], 
    ); 
  }), 

Reviews

Comments