Skip to content

Commit

Permalink
adjust homepage styling
Browse files Browse the repository at this point in the history
  • Loading branch information
12henbx committed Dec 3, 2023
1 parent cb6a485 commit 3cd9965
Showing 1 changed file with 139 additions and 112 deletions.
251 changes: 139 additions & 112 deletions app/lib/features/material/menu/presentation/pages/material_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,20 @@ class _MaterialMenuState extends State<MaterialMenu> {
child: OutlinedButton(
style: OutlinedButton.styleFrom(
backgroundColor: filterIndex == index ? Colors.blue : Colors.white,
side: BorderSide(width: 1, color: Color(0xFF1BB8E1),),
side: BorderSide(
width: 1,
color: Color(0xFF1BB8E1),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
),
),
// buttonType: filterIndex == index ? ButtonType.secondary : null,
child: Text(text, style: TextStyle(
fontSize: 14.0,
color: filterIndex == index ? Colors.white : Colors.grey,
)
),
child: Text(text,
style: TextStyle(
fontSize: 14.0,
color: filterIndex == index ? Colors.white : Colors.grey,
)),
onPressed: () {
setState(() {
filterIndex = index;
Expand Down Expand Up @@ -84,12 +87,20 @@ class _MaterialMenuState extends State<MaterialMenu> {
},
child: Container(
padding: const EdgeInsets.all(10),
margin: const EdgeInsets.only(bottom: 12, left: 5, right: 5,),
margin: const EdgeInsets.only(
bottom: 12,
left: 5,
right: 5,
),
height: 80,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: const BorderRadius.all(Radius.circular(24,),),
borderRadius: const BorderRadius.all(
Radius.circular(
24,
),
),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
Expand Down Expand Up @@ -133,120 +144,136 @@ class _MaterialMenuState extends State<MaterialMenu> {
@override
Widget build(BuildContext context) {
return
// BebrasScaffold(
// avoidBottomInset: false,
// body: Padding(
// padding: const EdgeInsets.only(top: 10),
// child:
// BebrasScaffold(
// avoidBottomInset: false,
// body: Padding(
// padding: const EdgeInsets.only(top: 10),
// child:
Stack(
children: [
Container(
// padding: const EdgeInsets.all(32),
child: Column(
children: [
// Image.asset(
// Assets.bebrasPandaiText,
// ),
// const SizedBox(
// height: 30,
// ),
SizedBox(
height: 40,
width: MediaQuery.of(context).size.width - 10,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
...bebrasGroupList.map(
(e) => materialTab(e.label, e.index),
children: [
Container(
padding: const EdgeInsets.only(
left: 25.0,
),
child: Column(
children: [
// Image.asset(
// Assets.bebrasPandaiText,
// ),
// const SizedBox(
// height: 30,
// ),
SizedBox(
height: 40,
width: MediaQuery.of(context).size.width - 10,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
...bebrasGroupList.map(
(e) => materialTab(e.label, e.index),
),
],
),
),
Container(
padding: const EdgeInsets.only(
right: 25.0,
),
child: Column(
children: [
const SizedBox(
height: 10,
),
const SizedBox(
width: double.infinity,
child: Text(
'Daftar Materi',
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
),
],
),
),
const SizedBox(
height: 10,
),
),
const SizedBox(
height: 10,
),
const SizedBox(
width: double.infinity,
child: Text('Daftar Materi'),
),
const SizedBox(
height: 10,
),
StreamBuilder<QuerySnapshot>(
stream: materialsStream,
builder: (
BuildContext context,
AsyncSnapshot<QuerySnapshot> snapshot,
) {
if (snapshot.hasError) {
return const Text('Something went wrong');
}
StreamBuilder<QuerySnapshot>(
stream: materialsStream,
builder: (
BuildContext context,
AsyncSnapshot<QuerySnapshot> snapshot,
) {
if (snapshot.hasError) {
return const Text('Something went wrong');
}

if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(
child: CircularProgressIndicator(),
);
}
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(
child: CircularProgressIndicator(),
);
}

var displayEmpty = true;
final boxHeight =
MediaQuery.of(context).size.height - 474;
return SingleChildScrollView(
child: SizedBox(
height: boxHeight,
width: double.infinity,
child: ListView(
children: [
...snapshot.data!.docs.map((d) {
final materialDoc =
d.data()! as Map<String, dynamic>;
if (materialDoc['challenge_group'] ==
bebrasGroupList[filterIndex].key) {
displayEmpty = false;
return materialItem(
d.id,
materialDoc['title'] as String,
materialDoc['url'] as String,
File('$basePath${d.id}.pdf').existsSync(),
);
}
return Container();
}),
if (displayEmpty)
Transform.translate(
offset: const Offset(
0,
-10,
), // Set the desired offset
child: Container(
height: boxHeight,
padding: const EdgeInsets.all(10),
margin: const EdgeInsets.only(
bottom: 12,
top: 12,
),
decoration: BoxDecoration(
color: Colors.blue[50],
borderRadius: BorderRadius.circular(8),
),
child: const Center(
child: Text(
'Materi belum ada',
var displayEmpty = true;
final boxHeight = MediaQuery.of(context).size.height - 474;
return SingleChildScrollView(
child: SizedBox(
height: boxHeight,
width: double.infinity,
child: ListView(
children: [
...snapshot.data!.docs.map((d) {
final materialDoc =
d.data()! as Map<String, dynamic>;
if (materialDoc['challenge_group'] ==
bebrasGroupList[filterIndex].key) {
displayEmpty = false;
return materialItem(
d.id,
materialDoc['title'] as String,
materialDoc['url'] as String,
File('$basePath${d.id}.pdf').existsSync(),
);
}
return Container();
}),
if (displayEmpty)
Transform.translate(
offset: const Offset(
0,
-10,
), // Set the desired offset
child: Container(
height: boxHeight,
padding: const EdgeInsets.all(10),
margin: const EdgeInsets.only(
bottom: 12,
top: 12,
),
decoration: BoxDecoration(
color: Colors.blue[50],
borderRadius: BorderRadius.circular(8),
),
child: const Center(
child: Text(
'Materi belum ada',
),
),
),
),
),
],
],
),
),
),
);
},
),
],
);
},
),
],
),
),
),
],
);
],
),
),
],
);
// ),
// );
}
Expand Down

0 comments on commit 3cd9965

Please sign in to comment.