fixing bug of search
This commit is contained in:
@@ -340,7 +340,7 @@ class ShiftsRepositoryImpl implements ShiftsRepositoryInterface {
|
|||||||
final DateTime? endDt = _toDateTime(sr.endTime);
|
final DateTime? endDt = _toDateTime(sr.endTime);
|
||||||
final DateTime? createdDt = _toDateTime(sr.createdAt);
|
final DateTime? createdDt = _toDateTime(sr.createdAt);
|
||||||
|
|
||||||
final String? staffId = _auth.currentUser?.uid;
|
final String? staffId = await _getStaffId();
|
||||||
bool hasApplied = false;
|
bool hasApplied = false;
|
||||||
String status = 'open';
|
String status = 'open';
|
||||||
if (staffId != null) {
|
if (staffId != null) {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
value: _bloc,
|
value: _bloc,
|
||||||
child: BlocBuilder<ShiftsBloc, ShiftsState>(
|
child: BlocBuilder<ShiftsBloc, ShiftsState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
|
final bool baseLoaded = state is ShiftsLoaded;
|
||||||
final List<Shift> myShifts = (state is ShiftsLoaded)
|
final List<Shift> myShifts = (state is ShiftsLoaded)
|
||||||
? state.myShifts
|
? state.myShifts
|
||||||
: [];
|
: [];
|
||||||
@@ -123,6 +124,7 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
"My Shifts",
|
"My Shifts",
|
||||||
UiIcons.calendar,
|
UiIcons.calendar,
|
||||||
myShifts.length,
|
myShifts.length,
|
||||||
|
enabled: true,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
_buildTab(
|
_buildTab(
|
||||||
@@ -132,6 +134,7 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
availableJobs
|
availableJobs
|
||||||
.length, // Passed unfiltered count as badge? Or logic inside? Pass availableJobs.
|
.length, // Passed unfiltered count as badge? Or logic inside? Pass availableJobs.
|
||||||
showCount: availableLoaded,
|
showCount: availableLoaded,
|
||||||
|
enabled: baseLoaded,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
_buildTab(
|
_buildTab(
|
||||||
@@ -140,6 +143,7 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
UiIcons.clock,
|
UiIcons.clock,
|
||||||
historyShifts.length,
|
historyShifts.length,
|
||||||
showCount: historyLoaded,
|
showCount: historyLoaded,
|
||||||
|
enabled: baseLoaded,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -207,11 +211,14 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
IconData icon,
|
IconData icon,
|
||||||
int count, {
|
int count, {
|
||||||
bool showCount = true,
|
bool showCount = true,
|
||||||
|
bool enabled = true,
|
||||||
}) {
|
}) {
|
||||||
final isActive = _activeTab == id;
|
final isActive = _activeTab == id;
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: !enabled
|
||||||
|
? null
|
||||||
|
: () {
|
||||||
setState(() => _activeTab = id);
|
setState(() => _activeTab = id);
|
||||||
if (id == 'history') {
|
if (id == 'history') {
|
||||||
_bloc.add(LoadHistoryShiftsEvent());
|
_bloc.add(LoadHistoryShiftsEvent());
|
||||||
@@ -235,7 +242,11 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
Icon(
|
Icon(
|
||||||
icon,
|
icon,
|
||||||
size: 14,
|
size: 14,
|
||||||
color: isActive ? AppColors.krowBlue : Colors.white,
|
color: !enabled
|
||||||
|
? Colors.white.withAlpha((0.5 * 255).round())
|
||||||
|
: isActive
|
||||||
|
? AppColors.krowBlue
|
||||||
|
: Colors.white,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Flexible(
|
Flexible(
|
||||||
@@ -244,7 +255,11 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: isActive ? AppColors.krowBlue : Colors.white,
|
color: !enabled
|
||||||
|
? Colors.white.withAlpha((0.5 * 255).round())
|
||||||
|
: isActive
|
||||||
|
? AppColors.krowBlue
|
||||||
|
: Colors.white,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user