Fakultas Ilmu Komputer UI

Commit 1497d4aa authored by Tsamara Esperanti Erwin's avatar Tsamara Esperanti Erwin
Browse files

[CHORES] Clean code

parent 070f1c29
...@@ -155,7 +155,7 @@ class Router { ...@@ -155,7 +155,7 @@ class Router {
RepositoryProvider.of<DependenciesRepositories>( RepositoryProvider.of<DependenciesRepositories>(
context) context)
.dio), .dio),
child: Programs() child: const Programs()
)); ));
case detailProgramPage: case detailProgramPage:
......
...@@ -60,7 +60,7 @@ class ProgramBloc extends Bloc<ProgramEvent, ProgramState> { ...@@ -60,7 +60,7 @@ class ProgramBloc extends Bloc<ProgramEvent, ProgramState> {
} }
} else if ((event is FetchProgramByStatus) && !_hasReachedMaxSorted(currentState)) { } else if ((event is FetchProgramByStatus) && !_hasReachedMaxSorted(currentState)) {
try { try {
var programs = final programs =
await programRepository.fetchProgram(page: currentState.page + 1); await programRepository.fetchProgram(page: currentState.page + 1);
if (currentState is ListProgramsLoaded || currentState is InitialListProgramState) { if (currentState is ListProgramsLoaded || currentState is InitialListProgramState) {
programs.results.sort((a,b) => b.endDateTime.compareTo(a.endDateTime)); programs.results.sort((a,b) => b.endDateTime.compareTo(a.endDateTime));
......
...@@ -69,17 +69,17 @@ class _ProgramsState extends State<Programs> { ...@@ -69,17 +69,17 @@ class _ProgramsState extends State<Programs> {
), ),
), ),
bottomNavigationBar: Container( bottomNavigationBar: Container(
margin: EdgeInsets.symmetric(horizontal: 25.0), margin: const EdgeInsets.symmetric(horizontal: 25.0),
child: Wrap(children: [ child: Wrap(children: [
Padding( const Padding(
padding: const EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 20),
child: Text('Urutkan Berdasarkan:', child: Text('Urutkan Berdasarkan:',
style: TextStyle(fontSize: 16.0),), style: TextStyle(fontSize: 16.0),),
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
programList = _ListProgramSortStatus(); programList = const _ListProgramSortStatus();
}); });
}, },
child: FilterButton(sort: 'Status') child: FilterButton(sort: 'Status')
...@@ -87,7 +87,7 @@ class _ProgramsState extends State<Programs> { ...@@ -87,7 +87,7 @@ class _ProgramsState extends State<Programs> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
programList = _ListProgram(); programList = const _ListProgram();
}); });
}, },
child: FilterButton(sort: 'Tanggal') child: FilterButton(sort: 'Tanggal')
...@@ -336,7 +336,7 @@ class ProgramCard extends StatelessWidget { ...@@ -336,7 +336,7 @@ class ProgramCard extends StatelessWidget {
class _ProgramDescription extends StatelessWidget { class _ProgramDescription extends StatelessWidget {
final Program program; final Program program;
_ProgramDescription({Key key, @required this.program}) const _ProgramDescription({Key key, @required this.program})
: assert(program != null), : assert(program != null),
super(key: key); super(key: key);
...@@ -383,7 +383,7 @@ class _ProgramDescription extends StatelessWidget { ...@@ -383,7 +383,7 @@ class _ProgramDescription extends StatelessWidget {
), ),
if ( program.endDateTime != null && if ( program.endDateTime != null &&
program.endDateTime.compareTo(CustomizableDateTime.current) < 1) program.endDateTime.compareTo(CustomizableDateTime.current) < 1)
Text( const Text(
'Selesai', 'Selesai',
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(fontWeight: FontWeight.bold),
) )
...@@ -429,7 +429,9 @@ class _DonasiButton extends StatelessWidget { ...@@ -429,7 +429,9 @@ class _DonasiButton extends StatelessWidget {
class FilterButton extends StatelessWidget { class FilterButton extends StatelessWidget {
final String sort; final String sort;
FilterButton({Key key, @required this.sort}); FilterButton({Key key, @required this.sort})
: assert(sort != null),
super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -442,7 +444,7 @@ class FilterButton extends StatelessWidget { ...@@ -442,7 +444,7 @@ class FilterButton extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0), padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
child: Text(sort, child: Text(sort,
style: TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
), ),
); );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment