Commit afd03dfd authored by Sandun Akalanka's avatar Sandun Akalanka

Initial directory for Community component

parent bd57d1dc
import 'package:flutter/material.dart';
class CommunityHome extends StatefulWidget {
const CommunityHome({super.key});
@override
State<CommunityHome> createState() => _CommunityHomeState();
}
class _CommunityHomeState extends State<CommunityHome> {
@override
Widget build(BuildContext context) {
return Scaffold();
}
}
import 'package:flutter/material.dart';
import 'ask_question.dart';
class CommunityHome extends StatefulWidget {
const CommunityHome({super.key});
@override
State<CommunityHome> createState() => _CommunityHomeState();
}
class _CommunityHomeState extends State<CommunityHome> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
children: [
const Divider(height: 10),
_cardBox(context, 'Ask Question', 'images/ask_question.jpg',
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const AskQuestionPage()),
);
}),
const Divider(height: 10),
_cardBox(
context,
'Browse Community',
'images/browse_community.jpg',
onPressed: () {},
),
//const Divider(height: 10),
],
)));
}
Widget _cardBox(BuildContext context, String text, String image,
{required void Function() onPressed}) {
return Container(
width: double.infinity,
height: 200,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black, width: 2),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
text,
style: const TextStyle(fontSize: 20, color: Colors.black),
),
Image.asset(
image,
fit: BoxFit.cover,
height: 150,
),
GestureDetector(
onTap: onPressed,
child: Container(),
//behavior: HitTestBehavior.translucent,
//onTapDown: onPressed,
),
],
),
);
}
}
Markdown is supported
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