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