Data display the same to every collection created

I created in flutter a fitness app and I am on my profile screen. I want the user to show another data when a new category is created, I will show the issue here : https://imgur.com/a/XiStzun
Here it’s the code for the page where workout schedule appears and all widgets( most essentially because all code doesn’t fit)

    class WorkoutContentAdded extends StatefulWidget {
      final String programId;
    
      const WorkoutContentAdded({Key? key, required this.programId}) : super(key: key);
    
      @override
      _WorkoutContentAddedState createState() => _WorkoutContentAddedState();
    }
    
    class _WorkoutContentAddedState extends State<WorkoutContentAdded> {
      late Stream<QuerySnapshot> _workoutScheduleStream;
    
      @override
      void initState() {
        super.initState();
        _initializeWorkoutScheduleStream();
      }
    
      @override
      void didUpdateWidget(WorkoutContentAdded oldWidget) {
        super.didUpdateWidget(oldWidget);
        if (oldWidget.programId != widget.programId) {
          _initializeWorkoutScheduleStream();
        }
      }
 void _initializeWorkoutScheduleStream() {
    print('Initializing workout schedule stream for program: ${widget.programId}');
    _workoutScheduleStream = FirebaseFirestore.instance
        .collection('programs')
        .doc(widget.programId)
        .collection('workout_schedule')
        .orderBy('order')
        .snapshots();
  }

  @override
  Widget build(BuildContext context) {
    print('Building WorkoutContentAdded for program: ${widget.programId}');
    return Scaffold(
      // ... other scaffold properties
      body: CustomScrollView(
        slivers: [
          // ... other slivers
          SliverToBoxAdapter(
            child: Padding(
              padding: EdgeInsets.fromLTRB(16, 16, 16, 0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    'Workout Schedule',
                    style: TextStyle(
                      fontSize: 20,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  StreamBuilder<QuerySnapshot>(
                    stream: _workoutScheduleStream,
                    builder: (context, scheduleSnapshot) {
 print('Workout schedule stream update for program: ${widget.programId}');
                      print('Connection state: ${scheduleSnapshot.connectionState}');
                      if (scheduleSnapshot.hasError) {
                        print('Error in schedule stream: ${scheduleSnapshot.error}');
                      }
                      if (scheduleSnapshot.hasData) {
                        print('Number of workout days: ${scheduleSnapshot.data!.docs.length}');
                      }

                      if (scheduleSnapshot.connectionState == ConnectionState.waiting) {
                        return CircularProgressIndicator();
                      }

                      if (scheduleSnapshot.hasError) {
                        return Text('Error: ${scheduleSnapshot.error}');
                      }

                      if (!scheduleSnapshot.hasData || scheduleSnapshot.data!.docs.isEmpty) {
                        return Padding(
                          padding: EdgeInsets.only(top: 16),
                          child: Text('No workout schedule added for this program.'),
                        );
                      }

                      List<DocumentSnapshot> sortedDocs = scheduleSnapshot.data!.docs;

                      return ListView.builder(
                        shrinkWrap: true,
                        physics: NeverScrollableScrollPhysics(),
                        itemCount: sortedDocs.length,
                        padding: EdgeInsets.only(top: 10),
                        itemBuilder: (context, index) {
 Map<String, dynamic> data = sortedDocs[index].data() as Map<String, dynamic>;
                          String day = data['day'] ?? 'Unknown Day';
                          return GestureDetector(
                            onTap: () {
                              Navigator.push(
                                context,
                                MaterialPageRoute(
                                  builder: (context) => VideoContent(
                                    day: day,
                                    allowEditing: true,
                                    programId: widget.programId,
                                  ),
                                ),
                              );
                            },
                            child: Card(
                              // Card content
                            ),
                          );
                        },
                      );
                    },
                  ),
                ],
                ),
            ),
          ),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _showAddCategoryBottomSheet,
        backgroundColor: Colors.black,
        child: Icon(Icons.add, color: Colors.white),
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
    );
  }
void _showAddCategoryBottomSheet() {
    String selectedOrdinal = '1st';
    String selectedDay = 'Monday';
    String estimatedKcal = '';

    showModalBottomSheet(
      context: context,
      isScrollControlled: true,
      backgroundColor: Colors.white,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
      ),
      builder: (BuildContext context) {
        return StatefulBuilder(
          builder: (BuildContext context, StateSetter setState) {
            return Padding(
              padding: EdgeInsets.only(
                bottom: MediaQuery.of(context).viewInsets.bottom,
                left: 24,
                right: 24,
                top: 24,
              ),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    'Choose the day of the week',
                    style: TextStyle(
                      fontSize: 18,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  SizedBox(height: 20),
                  Row(
                    children: [
                      Expanded(
                        child: DropdownButtonFormField<String>(
                          value: selectedOrdinal,
                          decoration: InputDecoration(
                            border: OutlineInputBorder(),
                            contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                          ),
                          items: ['1st', '2nd', '3rd', '4th']
                              .map((String value) {
                            return DropdownMenuItem<String>(
                              value: value,
                              child: Text(value),
                            );
                          }).toList(),
                          onChanged: (String? newValue) {
                            if (newValue != null) {
                              setState(() {
                                selectedOrdinal = newValue;
                              });
                            }
                          },
                        ),
                      ),
                      SizedBox(width: 10),
                      Expanded(
                        child: DropdownButtonFormField<String>(
                          value: selectedDay,
                          decoration: InputDecoration(
                            border: OutlineInputBorder(),
                            contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                          ),
                          items: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
                              .map((String value) {
                            return DropdownMenuItem<String>(
                              value: value,
                              child: Text(value),
                            );
                          }).toList(),
                          onChanged: (String? newValue) {
                            if (newValue != null) {
                              setState(() {
                                selectedDay = newValue;
                              });
                            }
                          },
                        ),
                      ),
                    ],
                  ),
                  SizedBox(height: 20),
                  TextField(
                    decoration: InputDecoration(
                      hintText: 'Estimative kcal burnt',
                      border: OutlineInputBorder(),
                    ),
                    keyboardType: TextInputType.number,
                    onChanged: (value) {
                      estimatedKcal = value;
                    },
                  ),
                  SizedBox(height: 20),
                  Center(
                    child: ElevatedButton(
                      onPressed: () async {
                        await FirebaseFirestore.instance.collection('workout_schedule').add({
                          'ordinal': selectedOrdinal,
                          'day': selectedDay,
                          'estimatedKcal': estimatedKcal,
                        });
                        Navigator.pop(context);
                      },
                      child: Text('Save'),
                      style: ElevatedButton.styleFrom(
                        backgroundColor: Colors.black,
                        foregroundColor: Colors.white,
                        padding: EdgeInsets.symmetric(horizontal: 32, vertical: 16),
                        shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(30),
                        ),
                      ),
                    ),
                  ),
                  SizedBox(height: 20),
                ],
              ),
            );
          }
        );
      },
    );
  }

    
    

Recognized by Google Cloud Collective

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật