Fakultas Ilmu Komputer UI

Commit 6418b35c authored by Agnes Handoko's avatar Agnes Handoko
Browse files

[REFACTOR] fix padding, margin, and font size to strive consistency in UI...

[REFACTOR] fix padding, margin, and font size to strive consistency in UI Implementation on list sekolah page
parents 12c42925 0222b878
Pipeline #41157 passed with stages
in 8 minutes and 55 seconds
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/component/bisago_appbar.dart';
import 'package:ppl_disabilitas/component/bisago_drawer.dart';
import 'package:flutter/widgets.dart';
import 'package:ppl_disabilitas/config/styles.dart';
class ListSekolah extends StatefulWidget {
......@@ -18,57 +18,174 @@ class _ListSekolahState extends State<ListSekolah> {
var showKategoriSekolah = false;
var showTingkatSekolah = false;
List<String> nama_sekolah = ["Sekolah Cita Buana", "SLB Negeri Kota Depok"];
List<String> alamat_sekolah = [
"Jl. Paso No.84, Jagakarsa, Kec. Jaga",
"Regency, Perumahan Permata"
];
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
drawer: BisaGoDrawer(),
body: SingleChildScrollView(
child: Column(children: <Widget>[
Container(
child: Row(
children: <Widget>[
Container(
decoration: BoxDecoration(boxShadow: regularShadow),
child: FlatButton(
key: Key('FilterButton'),
color: Colors.green[700],
textColor: Colors.white,
disabledColor: Colors.grey,
disabledTextColor: Colors.black,
padding: EdgeInsets.all(8),
shape: RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: BorderSide(color: Colors.transparent)),
splashColor: Colors.lightGreen,
onPressed: () => showModalBottomSheet(
context: context,
builder: (context) => InsideFilter(),
backgroundColor: Colors.transparent,
isScrollControlled: true),
child: Row(
children: <Widget>[
Icon(Icons.filter_list, color: Colors.white, size: 20),
Text(
"Filter Informasi",
style: TextStyle(fontSize: 13),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Padding(
padding: EdgeInsets.only(top: tripleSpace, left: doubleSpace, right: doubleSpace),
child: Text(
"Sekolah dengan Dukungan Disabilitas",
style: TextStyle(
fontSize: 25,
fontFamily: 'Muli',
fontWeight: FontWeight.w800),
),
),
],
),
),
Container(
padding: EdgeInsets.only(bottom: smallSpace),
margin: EdgeInsets.only(left: doubleSpace, right: doubleSpace),
decoration: BoxDecoration(boxShadow: regularShadow),
child: FlatButton(
key: Key('FilterButton'),
color: Colors.green[700],
textColor: Colors.white,
disabledColor: Colors.grey,
disabledTextColor: Colors.black,
padding: EdgeInsets.all(8),
shape: RoundedRectangleBorder(
borderRadius: regularBorderRadius,
side: BorderSide(color: Colors.transparent)),
splashColor: Colors.lightGreen,
onPressed: () => {showModalBottomSheet(
context: context,
builder: (context) => InsideFilter(),
backgroundColor: Colors.transparent,
isScrollControlled: true),
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(Icons.filter_list, color: Colors.white, size: 20),
Text(
"Filter Pencarian",
style: TextStyle(fontSize: 13),
),
],
),
),
),
Container(
child: makeLokasiWidget("sekolah", nama_sekolah, alamat_sekolah),
),
],
),
),
appBar: AppBar(
elevation: 15,
key: Key("appbar-text-informasi-sekolah"),
backgroundColor: greenPrimary,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios, size: 20),
key: Key('Back Icon Key'),
onPressed: () => Navigator.pop(context, 'Take me back')),
centerTitle: true,
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.all(doubleSpace),
child: Text(
"Informasi Sekolah",
style: TextStyle(
fontSize: 25,
fontFamily: 'Comfortaa',
fontWeight: FontWeight.w800),
),
)
],
),
])),
appBar: PreferredSize(
preferredSize: Size.fromHeight(55),
child: BisaGoAppBar(),
key: Key('Scaffold Text Field'),
),
);
}
Widget makeLokasiWidget(
String key, List<String> nama_sekolah, List<String> alamat_sekolah) {
return ListView.builder(
shrinkWrap: true,
itemCount: nama_sekolah.length,
itemBuilder: (context, index) {
return InkWell(
key: Key("$key-${nama_sekolah[index]}"),
onTap: () {},
child: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border(bottom: BorderSide(color: Colors.grey[400]))),
margin: EdgeInsets.only(left: doubleSpace, right: doubleSpace),
height: 90,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
CircleAvatar(
backgroundColor: greenPrimary,
child: Text('Test'),
),
Container(
padding: EdgeInsets.all(doubleSpace),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Flexible(
child: Text(
nama_sekolah[index],
softWrap: true,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w800,
color: Colors.black,
fontFamily: 'Muli',
),
),
),
Flexible(
child: Text(
alamat_sekolah[index],
softWrap: true,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 15,
color: Colors.black,
fontFamily: 'Muli',
),
),
),
],
),
),
],
),
Icon(
Icons.arrow_forward_ios,
color: Colors.grey[400],
size: 20,
)
],
),
),
);
});
}
InsideFilter() {
return StatefulBuilder(
builder: (context, setStateModal) => Container(
......
......@@ -15,22 +15,30 @@ void main() {
return MediaQuery(data: MediaQueryData(), child: MaterialApp(home: widget));
}
testWidgets("find a title app bar", (WidgetTester tester) async {
final textAppBar = Key("appbar-text-informasi-sekolah");
await tester.pumpWidget(MaterialApp(home: ListSekolah()));
expect(find.byKey(textAppBar), findsOneWidget);
expect(find.text("Sekolah dengan Dukungan Disabilitas"), findsOneWidget);
});
testWidgets('find inside filter page', (WidgetTester tester) async {
// Provide the childWidget to the Container.
await tester.pumpWidget(buildTestableWidget(ListSekolah()));
await tester.tap(find.byKey(Key('FilterButton')));
await tester.pump(Duration(seconds: 1));
expect(find.byType(Container), findsNWidgets(25));
expect(find.byType(Row), findsNWidgets(18));
expect(find.byType(Column), findsNWidgets(3));
expect(find.byType(Text), findsNWidgets(20));
expect(find.byType(Container), findsNWidgets(32));
expect(find.byType(Row), findsNWidgets(21));
expect(find.byType(Column), findsNWidgets(5));
expect(find.byType(Text), findsNWidgets(27));
expect(find.byType(Flex), findsNothing);
expect(find.text('jns fasilitas'), findsNothing);
expect(find.text('urutn'), findsNothing);
expect(find.text('hps smw'), findsNothing);
expect(find.byType(Scaffold), findsOneWidget);
expect(find.byType(Icon), findsNWidgets(3));
await tester.tap(find.byKey(Key('Scaffold Text Field')));
expect(find.byType(Icon), findsNWidgets(5));
await tester.tap(find.byKey(Key('FilterButton')));
await tester.pump();
});
}
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