Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
rajuAhmed1705 committed Aug 25, 2024
1 parent f74e5e7 commit 11db98a
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 64 deletions.
119 changes: 62 additions & 57 deletions designer_v2/lib/common_views/form_table_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,15 @@ class FormLabel extends StatelessWidget {
}

class FormLock extends StatefulWidget {
const FormLock(
{super.key,
required this.locked,
this.onLockChanged,
this.readOnly = false,
this.helpText,
this.lockedStateText,
this.unlockedStateText,});
const FormLock({
super.key,
required this.locked,
this.onLockChanged,
this.readOnly = false,
this.helpText,
this.lockedStateText,
this.unlockedStateText,
});

final bool locked;
final bool readOnly;
Expand All @@ -318,59 +319,63 @@ class _FormLockState extends State<FormLock> {
@override
Widget build(BuildContext context) {
final lockView = Material(
color: Colors.transparent,
child: Row(
children: [
Container(
decoration: BoxDecoration(
color: Colors.grey[100],
borderRadius: BorderRadius.circular(10.0),
border: Border.all(
color: Theme.of(context).disabledColor.withOpacity(0.05),),
color: Colors.transparent,
child: Row(
children: [
Container(
decoration: BoxDecoration(
color: Colors.grey[100],
borderRadius: BorderRadius.circular(10.0),
border: Border.all(
color: Theme.of(context).disabledColor.withOpacity(0.05),
),
),
padding: const EdgeInsets.all(6),
child: Row(
children: [
Text(
widget.locked
? widget.lockedStateText ?? 'Locked'
: widget.unlockedStateText ?? 'Unlocked',
style: Theme.of(context).textTheme.labelMedium,
),
padding: const EdgeInsets.all(6),
child: Row(
children: [
Text(
widget.locked
? widget.lockedStateText ?? 'Locked'
: widget.unlockedStateText ?? 'Unlocked',
style: Theme.of(context).textTheme.labelMedium,),
const SizedBox(width: 4),
AnimatedSwitcher(
duration: const Duration(milliseconds: 250),
child: Icon(
_locked ? MdiIcons.lock : MdiIcons.lockOpen,
color: _locked
? Theme.of(context).primaryColor
: Theme.of(context).disabledColor,
size: 18.0,
),
),
],
),),
SizedBox(
height: 30,
child: FittedBox(
child: Row(
children: [
Switch(
value: _locked,
onChanged: widget.readOnly
? null
: (value) {
setState(() {
_locked = value;
widget.onLockChanged?.call(_locked);
});
},
),
],
const SizedBox(width: 4),
AnimatedSwitcher(
duration: const Duration(milliseconds: 250),
child: Icon(
_locked ? MdiIcons.lock : MdiIcons.lockOpen,
color: _locked
? Theme.of(context).primaryColor
: Theme.of(context).disabledColor,
size: 18.0,
),
),
],
),
),
SizedBox(
height: 30,
child: FittedBox(
child: Row(
children: [
Switch(
value: _locked,
onChanged: widget.readOnly
? null
: (value) {
setState(() {
_locked = value;
widget.onLockChanged?.call(_locked);
});
},
),
],
),
),
],
),);
),
],
),
);

if (widget.helpText != null) {
return Tooltip(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class DashboardController extends _$DashboardController
);
}

void setColumnFilter(String filter) {
void setColumnFilter(String filter) {
state = state.copyWith(
columnFilter: () => filter,
);
Expand Down
9 changes: 5 additions & 4 deletions designer_v2/lib/features/dashboard/dashboard_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ class DashboardState extends Equatable {
final List<Study> filteredStudies = [];

columnFilter.split(',').forEach((element) {
filteredStudies.addAll(filterStudyByColumn(studies, element));
filteredStudies.addAll(filterStudyByColumn(studies, element));
});

List<Study> updatedStudies =
studiesFilter.apply(studies: filteredStudies, user: currentUser).toList();
List<Study> updatedStudies = studiesFilter
.apply(studies: filteredStudies, user: currentUser)
.toList();
updatedStudies = sort(
pinnedStudies: localPinnedStudies,
studiesToSort: filter(studiesToFilter: updatedStudies),
Expand Down Expand Up @@ -306,4 +307,4 @@ extension DashboardStateSafeViewProps on DashboardState {
return "[StudiesFilter.all]"; // not available in UI
}
}
}
}
2 changes: 1 addition & 1 deletion designer_v2/lib/features/dashboard/studies_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ extension StudiesFilterByUser on StudiesFilter {
);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class _StudiesTableColumnHeaderState extends State<StudiesTableColumnHeader> {

// Initialize selectedOptions with the existing state if not empty
if (selectedOptions.isEmpty) {
selectedOptions = []; // Could populate from existing filter state
selectedOptions = []; // Could populate from existing filter state
}

final renderBox = context.findRenderObject()! as RenderBox;
Expand Down

0 comments on commit 11db98a

Please sign in to comment.