Compare commits
2 Commits
5a23eb1768
...
8c19c32c76
| Author | SHA1 | Date | |
|---|---|---|---|
|
8c19c32c76
|
|||
|
d62b2bed80
|
@@ -1317,5 +1317,7 @@
|
|||||||
"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",
|
||||||
|
"pinnedPosts": "Pinned Posts"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -646,6 +676,7 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
|||||||
final periodEnd = useState<int?>(null);
|
final periodEnd = useState<int?>(null);
|
||||||
final showAdvancedFilters = useState(false);
|
final showAdvancedFilters = useState(false);
|
||||||
final subscribing = useState(false);
|
final subscribing = useState(false);
|
||||||
|
final isPinnedExpanded = useState(true);
|
||||||
|
|
||||||
Future<void> subscribe() async {
|
Future<void> subscribe() async {
|
||||||
final apiClient = ref.watch(apiClientProvider);
|
final apiClient = ref.watch(apiClientProvider);
|
||||||
@@ -716,7 +747,36 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
|||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverGap(16),
|
SliverGap(16),
|
||||||
SliverPostList(pubName: name, pinned: true),
|
SliverToBoxAdapter(
|
||||||
|
child: Card(
|
||||||
|
margin: EdgeInsets.symmetric(
|
||||||
|
horizontal: 8,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
child: ListTile(
|
||||||
|
title: Text('pinnedPosts'.tr()),
|
||||||
|
leading: const Icon(Symbols.push_pin),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: Icon(
|
||||||
|
isPinnedExpanded.value
|
||||||
|
? Symbols.expand_less
|
||||||
|
: Symbols.expand_more,
|
||||||
|
),
|
||||||
|
onTap:
|
||||||
|
() =>
|
||||||
|
isPinnedExpanded.value =
|
||||||
|
!isPinnedExpanded.value,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
...[
|
||||||
|
if (isPinnedExpanded.value)
|
||||||
|
SliverPostList(pubName: name, pinned: true),
|
||||||
|
],
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: _PublisherCategoryTabWidget(
|
child: _PublisherCategoryTabWidget(
|
||||||
categoryTabController: categoryTabController,
|
categoryTabController: categoryTabController,
|
||||||
@@ -855,7 +915,30 @@ class PublisherProfileScreen extends HookConsumerWidget {
|
|||||||
heatmap: heatmap,
|
heatmap: heatmap,
|
||||||
).padding(vertical: 4),
|
).padding(vertical: 4),
|
||||||
),
|
),
|
||||||
SliverPostList(pubName: name, pinned: true),
|
SliverToBoxAdapter(
|
||||||
|
child: Card(
|
||||||
|
margin: EdgeInsets.symmetric(
|
||||||
|
horizontal: 8,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
child: ListTile(
|
||||||
|
title: Text('pinnedPosts'.tr()),
|
||||||
|
trailing: Icon(
|
||||||
|
isPinnedExpanded.value
|
||||||
|
? Symbols.expand_less
|
||||||
|
: Symbols.expand_more,
|
||||||
|
),
|
||||||
|
onTap:
|
||||||
|
() =>
|
||||||
|
isPinnedExpanded.value =
|
||||||
|
!isPinnedExpanded.value,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
...[
|
||||||
|
if (isPinnedExpanded.value)
|
||||||
|
SliverPostList(pubName: name, pinned: true),
|
||||||
|
],
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: _PublisherCategoryTabWidget(
|
child: _PublisherCategoryTabWidget(
|
||||||
categoryTabController: categoryTabController,
|
categoryTabController: categoryTabController,
|
||||||
|
|||||||
Reference in New Issue
Block a user