💄 Optimize publisher page filter select date
This commit is contained in:
		@@ -1317,5 +1317,6 @@
 | 
				
			|||||||
    "fromDate": "From Date",
 | 
					    "fromDate": "From Date",
 | 
				
			||||||
    "toDate": "To Date",
 | 
					    "toDate": "To Date",
 | 
				
			||||||
    "popularity": "Popularity",
 | 
					    "popularity": "Popularity",
 | 
				
			||||||
    "descendingOrder": "Descending Order"
 | 
					    "descendingOrder": "Descending Order",
 | 
				
			||||||
 | 
					    "selectDate": "Select Date"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -487,64 +487,94 @@ class _PublisherCategoryTabWidget extends StatelessWidget {
 | 
				
			|||||||
                  Row(
 | 
					                  Row(
 | 
				
			||||||
                    children: [
 | 
					                    children: [
 | 
				
			||||||
                      Expanded(
 | 
					                      Expanded(
 | 
				
			||||||
                        child: TextField(
 | 
					                        child: InkWell(
 | 
				
			||||||
                          decoration: InputDecoration(
 | 
					                          onTap: () async {
 | 
				
			||||||
                            labelText: 'fromDate'.tr(),
 | 
					                            final pickedDate = await showDatePicker(
 | 
				
			||||||
                            hintText: 'YYYY-MM-DD',
 | 
					                              context: context,
 | 
				
			||||||
                            border: const OutlineInputBorder(
 | 
					                              initialDate:
 | 
				
			||||||
                              borderRadius: BorderRadius.all(
 | 
					                                  periodStart.value != null
 | 
				
			||||||
                                Radius.circular(12),
 | 
					                                      ? DateTime.fromMillisecondsSinceEpoch(
 | 
				
			||||||
 | 
					                                        periodStart.value! * 1000,
 | 
				
			||||||
 | 
					                                      )
 | 
				
			||||||
 | 
					                                      : DateTime.now(),
 | 
				
			||||||
 | 
					                              firstDate: DateTime(2000),
 | 
				
			||||||
 | 
					                              lastDate: DateTime.now().add(
 | 
				
			||||||
 | 
					                                const Duration(days: 365),
 | 
				
			||||||
                              ),
 | 
					                              ),
 | 
				
			||||||
                            ),
 | 
					                            );
 | 
				
			||||||
                            contentPadding: const EdgeInsets.symmetric(
 | 
					                            if (pickedDate != null) {
 | 
				
			||||||
                              horizontal: 12,
 | 
					                              periodStart.value =
 | 
				
			||||||
                              vertical: 8,
 | 
					                                  pickedDate.millisecondsSinceEpoch ~/ 1000;
 | 
				
			||||||
                            ),
 | 
					 | 
				
			||||||
                          ),
 | 
					 | 
				
			||||||
                          onChanged: (value) {
 | 
					 | 
				
			||||||
                            if (value.isEmpty) {
 | 
					 | 
				
			||||||
                              periodStart.value = null;
 | 
					 | 
				
			||||||
                            } else {
 | 
					 | 
				
			||||||
                              try {
 | 
					 | 
				
			||||||
                                final date = DateTime.parse(value);
 | 
					 | 
				
			||||||
                                periodStart.value =
 | 
					 | 
				
			||||||
                                    date.millisecondsSinceEpoch ~/ 1000;
 | 
					 | 
				
			||||||
                              } catch (_) {
 | 
					 | 
				
			||||||
                                periodStart.value = null;
 | 
					 | 
				
			||||||
                              }
 | 
					 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                          },
 | 
					                          },
 | 
				
			||||||
 | 
					                          child: InputDecorator(
 | 
				
			||||||
 | 
					                            decoration: InputDecoration(
 | 
				
			||||||
 | 
					                              labelText: 'fromDate'.tr(),
 | 
				
			||||||
 | 
					                              border: const OutlineInputBorder(
 | 
				
			||||||
 | 
					                                borderRadius: BorderRadius.all(
 | 
				
			||||||
 | 
					                                  Radius.circular(12),
 | 
				
			||||||
 | 
					                                ),
 | 
				
			||||||
 | 
					                              ),
 | 
				
			||||||
 | 
					                              contentPadding: const EdgeInsets.symmetric(
 | 
				
			||||||
 | 
					                                horizontal: 12,
 | 
				
			||||||
 | 
					                                vertical: 8,
 | 
				
			||||||
 | 
					                              ),
 | 
				
			||||||
 | 
					                              suffixIcon: const Icon(Symbols.calendar_today),
 | 
				
			||||||
 | 
					                            ),
 | 
				
			||||||
 | 
					                            child: Text(
 | 
				
			||||||
 | 
					                              periodStart.value != null
 | 
				
			||||||
 | 
					                                  ? DateTime.fromMillisecondsSinceEpoch(
 | 
				
			||||||
 | 
					                                    periodStart.value! * 1000,
 | 
				
			||||||
 | 
					                                  ).toString().split(' ')[0]
 | 
				
			||||||
 | 
					                                  : 'selectDate'.tr(),
 | 
				
			||||||
 | 
					                            ),
 | 
				
			||||||
 | 
					                          ),
 | 
				
			||||||
                        ),
 | 
					                        ),
 | 
				
			||||||
                      ),
 | 
					                      ),
 | 
				
			||||||
                      const Gap(8),
 | 
					                      const Gap(8),
 | 
				
			||||||
                      Expanded(
 | 
					                      Expanded(
 | 
				
			||||||
                        child: TextField(
 | 
					                        child: InkWell(
 | 
				
			||||||
                          decoration: InputDecoration(
 | 
					                          onTap: () async {
 | 
				
			||||||
                            labelText: 'toDate'.tr(),
 | 
					                            final pickedDate = await showDatePicker(
 | 
				
			||||||
                            hintText: 'YYYY-MM-DD',
 | 
					                              context: context,
 | 
				
			||||||
                            border: const OutlineInputBorder(
 | 
					                              initialDate:
 | 
				
			||||||
                              borderRadius: BorderRadius.all(
 | 
					                                  periodEnd.value != null
 | 
				
			||||||
                                Radius.circular(12),
 | 
					                                      ? DateTime.fromMillisecondsSinceEpoch(
 | 
				
			||||||
 | 
					                                        periodEnd.value! * 1000,
 | 
				
			||||||
 | 
					                                      )
 | 
				
			||||||
 | 
					                                      : DateTime.now(),
 | 
				
			||||||
 | 
					                              firstDate: DateTime(2000),
 | 
				
			||||||
 | 
					                              lastDate: DateTime.now().add(
 | 
				
			||||||
 | 
					                                const Duration(days: 365),
 | 
				
			||||||
                              ),
 | 
					                              ),
 | 
				
			||||||
                            ),
 | 
					                            );
 | 
				
			||||||
                            contentPadding: const EdgeInsets.symmetric(
 | 
					                            if (pickedDate != null) {
 | 
				
			||||||
                              horizontal: 12,
 | 
					                              periodEnd.value =
 | 
				
			||||||
                              vertical: 8,
 | 
					                                  pickedDate.millisecondsSinceEpoch ~/ 1000;
 | 
				
			||||||
                            ),
 | 
					 | 
				
			||||||
                          ),
 | 
					 | 
				
			||||||
                          onChanged: (value) {
 | 
					 | 
				
			||||||
                            if (value.isEmpty) {
 | 
					 | 
				
			||||||
                              periodEnd.value = null;
 | 
					 | 
				
			||||||
                            } else {
 | 
					 | 
				
			||||||
                              try {
 | 
					 | 
				
			||||||
                                final date = DateTime.parse(value);
 | 
					 | 
				
			||||||
                                periodEnd.value =
 | 
					 | 
				
			||||||
                                    date.millisecondsSinceEpoch ~/ 1000;
 | 
					 | 
				
			||||||
                              } catch (_) {
 | 
					 | 
				
			||||||
                                periodEnd.value = null;
 | 
					 | 
				
			||||||
                              }
 | 
					 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                          },
 | 
					                          },
 | 
				
			||||||
 | 
					                          child: InputDecorator(
 | 
				
			||||||
 | 
					                            decoration: InputDecoration(
 | 
				
			||||||
 | 
					                              labelText: 'toDate'.tr(),
 | 
				
			||||||
 | 
					                              border: const OutlineInputBorder(
 | 
				
			||||||
 | 
					                                borderRadius: BorderRadius.all(
 | 
				
			||||||
 | 
					                                  Radius.circular(12),
 | 
				
			||||||
 | 
					                                ),
 | 
				
			||||||
 | 
					                              ),
 | 
				
			||||||
 | 
					                              contentPadding: const EdgeInsets.symmetric(
 | 
				
			||||||
 | 
					                                horizontal: 12,
 | 
				
			||||||
 | 
					                                vertical: 8,
 | 
				
			||||||
 | 
					                              ),
 | 
				
			||||||
 | 
					                              suffixIcon: const Icon(Symbols.calendar_today),
 | 
				
			||||||
 | 
					                            ),
 | 
				
			||||||
 | 
					                            child: Text(
 | 
				
			||||||
 | 
					                              periodEnd.value != null
 | 
				
			||||||
 | 
					                                  ? DateTime.fromMillisecondsSinceEpoch(
 | 
				
			||||||
 | 
					                                    periodEnd.value! * 1000,
 | 
				
			||||||
 | 
					                                  ).toString().split(' ')[0]
 | 
				
			||||||
 | 
					                                  : 'selectDate'.tr(),
 | 
				
			||||||
 | 
					                            ),
 | 
				
			||||||
 | 
					                          ),
 | 
				
			||||||
                        ),
 | 
					                        ),
 | 
				
			||||||
                      ),
 | 
					                      ),
 | 
				
			||||||
                    ],
 | 
					                    ],
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user