repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/tourx_ui_c4 | mirrored_repositories/tourx_ui_c4/lib/main.dart | import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:introduction_screen/introduction_screen.dart';
import 'package:tourx_ui_c4/home_page.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Countrol4',
theme: ThemeData(
primarySwatch: Colors.purple,
visualDensity: VisualDensity.adaptivePlatformDensity),
home: const OnBoardingPage(),
);
}
}
////////////////////////////////////////////
///follor For more ig: @Countrol4offical
///@[email protected]
////////////////////////////////////////////
class OnBoardingPage extends StatefulWidget {
const OnBoardingPage({Key? key}) : super(key: key);
@override
_OnBoardingPageState createState() => _OnBoardingPageState();
}
class _OnBoardingPageState extends State<OnBoardingPage> {
final introKey = GlobalKey<IntroductionScreenState>();
void _onIntroEnd(context) {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => const HomePage()),
);
}
@override
Widget build(BuildContext context) {
double sizeHeight = MediaQuery.of(context).size.height;
double sizeWidth = MediaQuery.of(context).size.width;
const pageDecoration = PageDecoration(
pageColor: Colors.white,
imagePadding: EdgeInsets.zero,
fullScreen: true,
bodyFlex: 0);
return IntroductionScreen(
key: introKey,
globalBackgroundColor: Colors.black,
pages: [
PageViewModel(
title: "",
body: "",
decoration: pageDecoration,
image: Stack(children: [
Container(
height: sizeHeight * 1,
width: sizeWidth * 1,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/3.png",
),
fit: BoxFit.cover,
)),
),
Container(
width: sizeWidth * 1,
height: sizeHeight * 1,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black.withOpacity(0.1),
Colors.black.withOpacity(0.2),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.9),
Colors.black
],
)),
),
const Positioned(
left: 20,
bottom: 200,
child: Text(
"Let's Tour",
style: TextStyle(
fontSize: 40,
color: Color(0xffFD4416),
fontWeight: FontWeight.bold),
)),
const Positioned(
left: 20,
bottom: 130,
child: Text(
"Plan your Vacation \nWith Us",
style: TextStyle(
fontFamily: "mont",
fontSize: 30,
color: Colors.white,
fontWeight: FontWeight.w500),
)),
])),
PageViewModel(
title: "",
body: "",
decoration: pageDecoration,
image: Stack(children: [
Container(
height: sizeHeight * 1,
width: sizeWidth * 1,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/4.png",
),
fit: BoxFit.cover,
)),
),
Container(
width: sizeWidth * 1,
height: sizeHeight * 1,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black.withOpacity(0.1),
Colors.black.withOpacity(0.2),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.9),
Colors.black
],
)),
),
const Positioned(
left: 20,
bottom: 200,
child: Text(
"Easy To Use",
style: TextStyle(
fontSize: 40,
color: Color(0xffFD4416),
fontWeight: FontWeight.bold),
)),
const Positioned(
left: 15,
bottom: 120,
child: Text(
"Finish your transactions \nover the phone.",
style: TextStyle(
fontSize: 30,
color: Colors.white,
fontWeight: FontWeight.w500,
fontFamily: "mont"),
)),
])),
PageViewModel(
title: "",
body: "",
decoration: pageDecoration,
image: Stack(children: [
Container(
height: sizeHeight * 1,
width: sizeWidth * 1,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/5.png",
),
fit: BoxFit.cover,
)),
),
Container(
width: sizeWidth * 1,
height: sizeHeight * 1,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black.withOpacity(0.1),
Colors.black.withOpacity(0.2),
Colors.black.withOpacity(0.3),
Colors.black.withOpacity(0.9),
Colors.black
],
)),
),
const Positioned(
left: 20,
bottom: 200,
child: Text(
"Quick Reservation",
style: TextStyle(
fontSize: 40,
color: Color(0xffFD4416),
fontWeight: FontWeight.bold),
)),
const Positioned(
left: 20,
bottom: 120,
child: Text(
"Let's finish your \nreservation together",
style: TextStyle(
fontSize: 30,
color: Colors.white,
fontWeight: FontWeight.w500,
fontFamily: "mont"),
)),
]))
],
onDone: () => _onIntroEnd(context),
showSkipButton: false,
skipFlex: 0,
nextFlex: 0,
skip: const Text('Skip', style: TextStyle(color: Colors.white)),
next: Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: const Color(0xffFD4416),
borderRadius: BorderRadius.circular(30)),
child: const Icon(
Icons.arrow_forward,
color: Colors.white,
),
),
done: Container(
margin: const EdgeInsets.fromLTRB(0, 7, 0, 20),
child: const Text('Done',
style: TextStyle(
fontWeight: FontWeight.w600,
color: Colors.white,
fontSize: 20)),
),
curve: Curves.fastLinearToSlowEaseIn,
controlsMargin: const EdgeInsets.all(0),
controlsPadding: kIsWeb
? const EdgeInsets.all(0.0)
: const EdgeInsets.fromLTRB(0.0, 4.0, 0.0, 4.0),
dotsDecorator: const DotsDecorator(
size: Size(10.0, 5.0),
spacing: EdgeInsets.only(right: 10),
color: Colors.white,
activeColor: Color(0xffFD4416),
activeSize: Size(50.0, 5.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
activeShape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
),
dotsContainerDecorator: const ShapeDecoration(
color: Colors.black87,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(0.0)),
),
),
);
}
}
class CurrentPage extends StatelessWidget {
const CurrentPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const HomePage();
}
}
| 0 |
mirrored_repositories/tourx_ui_c4/lib | mirrored_repositories/tourx_ui_c4/lib/drawer/settings.dart | import 'package:flutter/material.dart';
import 'package:tourx_ui_c4/main.dart';
class SettingsPage extends StatefulWidget {
const SettingsPage({Key? key}) : super(key: key);
@override
_SettingsPageState createState() => _SettingsPageState();
}
class _SettingsPageState extends State<SettingsPage> {
@override
Widget build(BuildContext context) {
double sizeWidth = MediaQuery.of(context).size.width;
return SafeArea(
child: Scaffold(
backgroundColor: Colors.white,
body: ListView(
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent, elevation: 0),
onPressed: () {},
child: SizedBox(
width: sizeWidth * 1,
child: const Text(
"Manage Accounts",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
color: Color(0xffFD4416)),
textAlign: TextAlign.start,
),
)),
const Divider(),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent, elevation: 0),
onPressed: () {},
child: SizedBox(
width: sizeWidth * 1,
child: const Text(
"Tax Documents ",
style: TextStyle(
color: Color(0xffFD4416),
fontSize: 20,
fontWeight: FontWeight.w300),
textAlign: TextAlign.start,
),
)),
const Divider(),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent, elevation: 0),
onPressed: () {},
child: SizedBox(
width: sizeWidth * 1,
child: const Text(
"Password Code and Touch_ID",
style: TextStyle(
color: Color(0xffFD4416),
fontSize: 20,
fontWeight: FontWeight.w300),
textAlign: TextAlign.start,
),
)),
const Divider(),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent, elevation: 0),
onPressed: () {},
child: SizedBox(
width: sizeWidth * 1,
child: const Text(
"Notification",
style: TextStyle(
color: Color(0xffFD4416),
fontSize: 20,
fontWeight: FontWeight.w300),
textAlign: TextAlign.start,
),
)),
const Divider(),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent, elevation: 0),
onPressed: () {},
child: SizedBox(
width: sizeWidth * 1,
child: const Text(
"Personal Information",
style: TextStyle(
color: Color(0xffFD4416),
fontSize: 20,
fontWeight: FontWeight.w300),
textAlign: TextAlign.start,
),
)),
const Divider(),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent, elevation: 0),
onPressed: () {},
child: SizedBox(
width: sizeWidth * 1,
child: const Text(
"Find Location",
style: TextStyle(
color: Color(0xffFD4416),
fontSize: 20,
fontWeight: FontWeight.w300),
textAlign: TextAlign.start,
),
)),
const Divider(),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent, elevation: 0),
onPressed: () {},
child: SizedBox(
width: sizeWidth * 1,
child: const Text(
"Help",
style: TextStyle(
color: Color(0xffFD4416),
fontSize: 20,
fontWeight: FontWeight.w300),
textAlign: TextAlign.start,
),
)),
const Divider(),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent, elevation: 0),
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => const MyApp(),
));
},
child: Container(
padding: const EdgeInsets.all(100),
width: sizeWidth * 1,
child: const Text(
"Log Out",
style: TextStyle(
color: Color(0xffFD4416),
fontSize: 20,
fontWeight: FontWeight.w300),
textAlign: TextAlign.center,
),
)),
const Divider(),
],
),
));
}
}
| 0 |
mirrored_repositories/tourx_ui_c4/lib | mirrored_repositories/tourx_ui_c4/lib/tabs/home_bar.dart | import 'dart:ui';
import 'package:animations/animations.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'package:tourx_ui_c4/OpenContainers/cappadocia.dart';
class IndexOne extends StatefulWidget {
const IndexOne({Key? key}) : super(key: key);
@override
_IndexOneState createState() => _IndexOneState();
}
class _IndexOneState extends State<IndexOne> {
@override
Widget build(BuildContext context) {
ContainerTransitionType _containerTransitionType =
ContainerTransitionType.fade;
return SafeArea(child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Scaffold(
backgroundColor: Colors.white,
resizeToAvoidBottomInset: false,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.all(10.0),
child: Text(
"Discover \nA New World",
style: TextStyle(fontSize: 35, fontFamily: "mont"),
),
),
Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10),
child: TextFormField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Search watches, brands',
hintStyle:
TextStyle(color: const Color(0xffFD4416).withOpacity(0.6)),
filled: true,
fillColor: const Color(0xffFD4416).withOpacity(0.1),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 2,
color: const Color(0xffFD4416).withOpacity(0.5),
),
borderRadius: BorderRadius.circular(80.0),
),
enabledBorder: UnderlineInputBorder(
borderSide: const BorderSide(color: Colors.transparent),
borderRadius: BorderRadius.circular(80.0),
),
prefixIcon: IconButton(
onPressed: () {},
icon: Icon(
Icons.search,
color: const Color(0xffFD4416).withOpacity(0.6),
),
),
suffixIcon: Container(
height: 55,
decoration: (const BoxDecoration(
color: Color(0xffFD4416),
borderRadius: BorderRadius.all(Radius.circular(10)))),
width: 55,
child: IconButton(
color: Colors.white,
onPressed: () {},
icon: const Icon(
Icons.filter_alt_rounded,
color: Colors.white,
),
),
),
)),
),
CarouselSlider(
items: [
Container(
margin: const EdgeInsets.fromLTRB(0, 35, 0, 0),
width: 400,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(35)),
image: DecorationImage(
image: NetworkImage(
"https://tatilsepeti.cubecdn.net/Files/TurResim/10881/tsr10881637692214157863464.jpg"),
fit: BoxFit.cover)),
child: Container(
margin: const EdgeInsets.fromLTRB(15, 290, 15, 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Colors.white10),
width: 150,
height: 50,
child: ClipRRect(
borderRadius: BorderRadius.circular(35),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5.0, sigmaY: 5.0),
child: OpenContainer(
transitionType: _containerTransitionType,
transitionDuration: const Duration(seconds: 2),
openBuilder: (context, _) =>
const CappadociaPage(),
closedElevation: 0,
closedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(35),
side: const BorderSide(
color: Colors.transparent,
)),
closedColor: Colors.white.withOpacity(0.1),
closedBuilder: (context, _) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
Container(
margin:
const EdgeInsets.fromLTRB(25, 15, 0, 0),
width: 60,
height: 20,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(30))),
child: const Text(
"Swiss",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "mont",
fontWeight: FontWeight.bold,
fontSize: 15,
color: Color(0xffFD4416),
),
),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
const Padding(
padding: EdgeInsets.only(left: 15.0),
child: Text("Switzerland",
style: TextStyle(
fontSize: 30,
fontFamily: "mont",
color: Colors.black,
fontWeight: FontWeight.bold)),
),
Container(
margin:
const EdgeInsets.only(right: 15.0),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(80))),
child: IconButton(
onPressed: () {},
icon: const Icon(
Icons.shopping_cart_rounded)),
),
],
),
const Padding(
padding: EdgeInsets.only(left: 20.0),
child: Text("\$94.00",
style: TextStyle(
fontSize: 15,
fontFamily: "mont",
color: Colors.black,
fontWeight: FontWeight.bold)),
),
],
),
)),
),
),
),
Container(
margin: const EdgeInsets.fromLTRB(0, 35, 0, 0),
width: 400,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(35)),
image: DecorationImage(
image: AssetImage("assets/capadoccia/c1.jpg"),
fit: BoxFit.cover)),
child: Container(
margin: const EdgeInsets.fromLTRB(15, 290, 15, 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Colors.white10),
width: 150,
height: 50,
child: ClipRRect(
borderRadius: BorderRadius.circular(35),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5.0, sigmaY: 5.0),
child: OpenContainer(
transitionType: _containerTransitionType,
transitionDuration: const Duration(seconds: 2),
openBuilder: (context, _) =>
const CappadociaPage(),
closedElevation: 0,
closedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(35),
side: const BorderSide(
color: Colors.transparent,
)),
closedColor: Colors.white.withOpacity(0.1),
closedBuilder: (context, _) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
Container(
margin:
const EdgeInsets.fromLTRB(25, 15, 0, 0),
width: 60,
height: 20,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(30))),
child: const Text(
"Turkey",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "mont",
fontWeight: FontWeight.bold,
fontSize: 15,
color: Color(0xffFD4416),
),
),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
const Text("Cappadocia",
style: TextStyle(
fontSize: 30,
fontFamily: "mont",
color: Colors.black,
fontWeight: FontWeight.bold)),
Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(80))),
child: IconButton(
onPressed: () {},
icon: const Icon(
Icons.shopping_cart_rounded)),
),
],
),
const Padding(
padding: EdgeInsets.only(left: 20.0),
child: Text("\$50.00",
style: TextStyle(
fontSize: 15,
fontFamily: "mont",
color: Colors.black,
fontWeight: FontWeight.bold)),
),
],
),
)),
),
),
),
Container(
margin: const EdgeInsets.fromLTRB(0, 35, 0, 0),
width: 400,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(35)),
image: DecorationImage(
image: NetworkImage(
"https://upload.travelawaits.com/ta/uploads/2021/04/eiffel-tower.jpg"),
fit: BoxFit.cover)),
child: Container(
margin: const EdgeInsets.fromLTRB(15, 290, 15, 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Colors.white10),
width: 150,
height: 50,
child: ClipRRect(
borderRadius: BorderRadius.circular(35),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5.0, sigmaY: 5.0),
child: OpenContainer(
transitionType: _containerTransitionType,
transitionDuration: const Duration(seconds: 2),
openBuilder: (context, _) =>
const CappadociaPage(),
closedElevation: 0,
closedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(35),
side: const BorderSide(
color: Colors.transparent,
)),
closedColor: Colors.white.withOpacity(0.1),
closedBuilder: (context, _) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
Container(
margin:
const EdgeInsets.fromLTRB(25, 15, 0, 0),
width: 60,
height: 20,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(30))),
child: const Text(
"France",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "mont",
fontWeight: FontWeight.bold,
fontSize: 15,
color: Color(0xffFD4416),
),
),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
const Padding(
padding: EdgeInsets.only(left: 15.0),
child: Text("Paris",
style: TextStyle(
fontSize: 30,
fontFamily: "mont",
color: Colors.black,
fontWeight: FontWeight.bold)),
),
Container(
margin:
const EdgeInsets.only(right: 15.0),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(80))),
child: IconButton(
onPressed: () {},
icon: const Icon(
Icons.shopping_cart_rounded)),
),
],
),
const Padding(
padding: EdgeInsets.only(left: 20.0),
child: Text("\$89.00",
style: TextStyle(
fontSize: 15,
fontFamily: "mont",
color: Colors.black,
fontWeight: FontWeight.bold)),
),
],
),
)),
),
),
),
Container(
margin: const EdgeInsets.fromLTRB(0, 35, 0, 0),
width: 400,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(35)),
image: DecorationImage(
image: NetworkImage(
"https://www.bodisatravel.com/images/tour/115_vitrin.jpg"),
fit: BoxFit.cover)),
child: Container(
margin: const EdgeInsets.fromLTRB(15, 290, 15, 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Colors.white10),
width: 150,
height: 50,
child: ClipRRect(
borderRadius: BorderRadius.circular(35),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5.0, sigmaY: 5.0),
child: OpenContainer(
transitionType: _containerTransitionType,
transitionDuration: const Duration(seconds: 2),
openBuilder: (context, _) =>
const CappadociaPage(),
closedElevation: 0,
closedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(35),
side: const BorderSide(
color: Colors.transparent,
)),
closedColor: Colors.white.withOpacity(0.1),
closedBuilder: (context, _) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
Container(
margin:
const EdgeInsets.fromLTRB(25, 15, 0, 0),
width: 60,
height: 20,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(30))),
child: const Text(
"Italy",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "mont",
fontWeight: FontWeight.bold,
fontSize: 15,
color: Color(0xffFD4416),
),
),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
const Padding(
padding: EdgeInsets.only(left: 15.0),
child: Text("Pisa",
style: TextStyle(
fontSize: 30,
fontFamily: "mont",
color: Colors.black,
fontWeight: FontWeight.bold)),
),
Container(
margin:
const EdgeInsets.only(right: 15.0),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(80))),
child: IconButton(
onPressed: () {},
icon: const Icon(
Icons.shopping_cart_rounded)),
),
],
),
const Padding(
padding: EdgeInsets.only(left: 20.0),
child: Text("\$34.00",
style: TextStyle(
fontSize: 15,
fontFamily: "mont",
color: Colors.black,
fontWeight: FontWeight.bold)),
),
],
),
)),
),
),
),
],
options: CarouselOptions(
pauseAutoPlayOnTouch: true,
height: 450.0,
aspectRatio: 16 / 9,
viewportFraction: 0.8,
initialPage: 5,
enableInfiniteScroll: false,
reverse: true,
autoPlay: false,
autoPlayInterval: const Duration(seconds: 3),
autoPlayAnimationDuration: const Duration(milliseconds: 800),
autoPlayCurve: Curves.decelerate,
enlargeCenterPage: true,
scrollDirection: Axis.horizontal,
)),
],
),
);
}));
}
}
| 0 |
mirrored_repositories/tourx_ui_c4/lib | mirrored_repositories/tourx_ui_c4/lib/OpenContainers/cappadocia.dart | import 'package:animations/animations.dart';
import 'package:elastic_drawer/elastic_drawer.dart';
import 'package:flutter/material.dart';
class CappadociaPage extends StatefulWidget {
const CappadociaPage({Key? key}) : super(key: key);
@override
_CappadociaPageState createState() => _CappadociaPageState();
}
class _CappadociaPageState extends State<CappadociaPage> {
final ContainerTransitionType _containerTransitionType =
ContainerTransitionType.fade;
////////////////////////////////////////////
///follow For more ig: @Countrol4offical
///@[email protected]
////////////////////////////////////////////
bool ticked = true;
@override
Widget build(BuildContext context) {
return SafeArea(
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return Scaffold(
body: SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: Stack(
children: [
Positioned(
top: 10,
left: 5,
right: 5,
child: Container(
height: MediaQuery.of(context).size.height * 0.5,
width: MediaQuery.of(context).size.width * 1,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c1.jpg",
),
fit: BoxFit.cover)),
child: Stack(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(
left: 15.0, right: 15, top: 25),
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
child: const Icon(
Icons.chevron_left_outlined,
color: Colors.black,
size: 35,
),
style: ElevatedButton.styleFrom(
elevation: 0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(8),
primary: Colors.white
.withOpacity(0.5), // <-- Button color
/* onPrimary: const Color(0xffFD4416), */ // <-- Splash color
),
),
),
const Text(
"Trip Details",
style: TextStyle(
fontFamily: "mont",
fontSize: 15,
color: Colors.black,
fontWeight: FontWeight.w700),
),
Padding(
padding: const EdgeInsets.only(
left: 15.0, right: 15, top: 25),
child: ElevatedButton(
onPressed: () {
setState(() {
ticked = !ticked;
});
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(
margin: const EdgeInsets.only(
left: 15,
right: 15,
bottom: 5,
),
content: const Text(
'Trip Saved ',
style: TextStyle(
fontFamily: "mont",
fontSize: 15,
fontWeight: FontWeight.bold,
color: Colors.white),
),
duration: const Duration(seconds: 1),
backgroundColor: Colors.grey.shade800,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(5)),
behavior: SnackBarBehavior.floating,
elevation: 0,
));
},
child: Icon(
ticked
? Icons.bookmark_border_outlined
: Icons.bookmark,
color: Colors.black,
size: 35,
),
style: ElevatedButton.styleFrom(
elevation: 0,
shape: const CircleBorder(),
padding: const EdgeInsets.all(8),
primary: Colors.white
.withOpacity(0.5), // <-- Button color
/* onPrimary: const Color(0xffFD4416), */ // <-- Splash color
),
),
),
],
),
Positioned(
bottom: 15,
left: 15,
right: 15,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
OpenContainer(
transitionType: _containerTransitionType,
transitionDuration:
const Duration(seconds: 1),
openBuilder: (context, _) => ElasticDrawer(
markPosition: 0.9,
mainColor: Colors.transparent,
drawerColor:
Colors.black.withOpacity(0.3),
mainChild: Column(
children: [
Expanded(
child: Container(
height: MediaQuery.of(context)
.size
.height *
1,
width: MediaQuery.of(context)
.size
.width *
1,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c2.jpg"),
fit: BoxFit.cover)),
),
),
],
),
drawerChild: Column(
children: [
Expanded(
child: Container(
height: MediaQuery.of(context)
.size
.height *
1,
width: MediaQuery.of(context)
.size
.width *
1,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c3.jpg"),
fit: BoxFit.cover)),
),
),
],
),
),
closedElevation: 0,
closedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
side: const BorderSide(
width: 2,
color: Colors.white,
)),
closedColor: Colors.white.withOpacity(0.1),
closedBuilder: (context, _) => Container(
width:
MediaQuery.of(context).size.width *
0.25,
height:
MediaQuery.of(context).size.height *
0.13,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(2)),
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c2.jpg"),
fit: BoxFit.cover)))),
OpenContainer(
transitionType: _containerTransitionType,
transitionDuration:
const Duration(seconds: 1),
openBuilder: (context, _) => ElasticDrawer(
markPosition: 0.9,
mainColor: Colors.transparent,
drawerColor:
Colors.black.withOpacity(0.3),
mainChild: Column(
children: [
Expanded(
child: Container(
height: MediaQuery.of(context)
.size
.height *
1,
width: MediaQuery.of(context)
.size
.width *
1,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c6.jpg"),
fit: BoxFit.cover)),
),
),
],
),
drawerChild: Column(
children: [
Expanded(
child: Container(
height: MediaQuery.of(context)
.size
.height *
1,
width: MediaQuery.of(context)
.size
.width *
1,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c7.jpg"),
fit: BoxFit.cover)),
),
),
],
),
),
closedElevation: 0,
closedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
side: const BorderSide(
width: 2,
color: Colors.white,
)),
closedColor: Colors.white.withOpacity(0.1),
closedBuilder: (context, _) => Container(
width:
MediaQuery.of(context).size.width *
0.25,
height:
MediaQuery.of(context).size.height *
0.13,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(2)),
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c6.jpg"),
fit: BoxFit.cover)))),
OpenContainer(
transitionType: _containerTransitionType,
transitionDuration:
const Duration(seconds: 1),
openBuilder: (context, _) => ElasticDrawer(
markPosition: 0.9,
mainColor: Colors.transparent,
drawerColor:
Colors.black.withOpacity(0.3),
mainChild: Column(
children: [
Expanded(
child: Container(
height: MediaQuery.of(context)
.size
.height *
1,
width: MediaQuery.of(context)
.size
.width *
1,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c4.jpg"),
fit: BoxFit.cover)),
),
),
],
),
drawerChild: Column(
children: [
Expanded(
child: Container(
height: MediaQuery.of(context)
.size
.height *
1,
width: MediaQuery.of(context)
.size
.width *
1,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c5.jpg"),
fit: BoxFit.cover)),
),
),
],
),
),
closedElevation: 0,
closedShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
side: const BorderSide(
width: 2,
color: Colors.white,
)),
closedColor: Colors.white.withOpacity(0.1),
closedBuilder: (context, _) => Container(
width:
MediaQuery.of(context).size.width *
0.25,
height:
MediaQuery.of(context).size.height *
0.13,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(2)),
image: DecorationImage(
image: AssetImage(
"assets/capadoccia/c4.jpg"),
fit: BoxFit.cover)))),
],
),
),
],
),
),
),
Positioned(
bottom: 330,
left: 5,
right: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
margin: const EdgeInsets.fromLTRB(25, 15, 0, 0),
width: 60,
height: 20,
decoration: BoxDecoration(
color: const Color(0xffFD4416).withOpacity(0.2),
borderRadius:
const BorderRadius.all(Radius.circular(30))),
child: const Text(
"Turkey",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "mont",
fontWeight: FontWeight.bold,
fontSize: 15,
color: Color(0xffFD4416),
),
),
),
const Text(
"\$50.00",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "mont",
fontWeight: FontWeight.bold,
fontSize: 30,
color: Colors.black,
),
),
],
),
),
const Positioned(
bottom: 250,
left: 15,
child: Text("Cappadocia",
style: TextStyle(
fontFamily: "mont",
fontWeight: FontWeight.bold,
fontSize: 35,
))),
Positioned(
bottom: 200,
left: 15,
child: Row(
children: [
const Icon(
Icons.star_rounded,
color: Color(0xffFD4416),
),
Text(
"5.0",
style: TextStyle(
color: Colors.grey.withOpacity(0.5),
fontSize: 20),
),
const SizedBox(
width: 30,
),
const Icon(
Icons.timer,
color: Color(0xffFD4416),
),
Text(
"30 min",
style: TextStyle(
color: Colors.grey.withOpacity(0.5),
fontSize: 20),
),
const SizedBox(
width: 30,
),
const Icon(
Icons.location_on,
color: Color(0xffFD4416),
),
Text(
"15 km",
style: TextStyle(
color: Colors.grey.withOpacity(0.5),
fontSize: 20),
),
],
)),
Positioned(
bottom: 80,
left: 20,
right: 20,
child: Container(
height: 100,
width: MediaQuery.of(context).size.width * 1,
child: Text(
"Cappadocia in central Turkey is perhaps most well-known for the panoramic view of hundreds of hot air balloons ebbing and flowing above valleys and volcanic “fairy chimney” formations. Though it is but one of the many things to do in Cappadocia, hot air ballooning is one of the most popular activities in the region for a number of reasons.",
style: TextStyle(
fontFamily: "mont", color: Colors.grey.shade700),
),
alignment: Alignment.center,
)),
Positioned(
bottom: 10,
right: 60,
left: 60,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 50, vertical: 15),
primary: const Color(0xffFD4416),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
30.0,
),
)),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
margin: const EdgeInsets.only(
left: 15,
right: 15,
bottom: 350,
),
content: const Text(
'Trip Added Chart ',
style: TextStyle(
fontFamily: "mont",
fontSize: 15,
fontWeight: FontWeight.bold,
color: Colors.white),
textAlign: TextAlign.center,
),
duration: const Duration(seconds: 1),
backgroundColor: Colors.grey.shade800,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5)),
behavior: SnackBarBehavior.floating,
elevation: 0,
));
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
const Text(
"Book Now",
style: TextStyle(
color: Colors.white,
fontFamily: "mont",
fontWeight: FontWeight.bold,
fontSize: 15),
),
Container(
decoration: const BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(30)),
color: Colors.white,
),
child: const Icon(
Icons.arrow_forward_ios_rounded,
color: Color(0xffFD4416),
))
],
),
))
],
),
),
);
},
),
);
}
}
| 0 |
mirrored_repositories/tourx_ui_c4 | mirrored_repositories/tourx_ui_c4/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tourx_ui_c4/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/bmi_app | mirrored_repositories/bmi_app/lib/mainpage.dart | import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
//Colors for bg
var defaultBg = const Color.fromARGB(255, 246, 247, 246);
var underweight = const Color.fromARGB(255, 134, 177, 227);
var normal = const Color.fromARGB(255, 193, 232, 152);
var overweight = const Color.fromARGB(255, 243, 138, 140);
//color for button
var buttoncolor = const Color.fromARGB(255, 140, 140, 210);
var resbutton = const Color.fromARGB(255, 244, 244, 245);
//color for text
var nortext = Colors.black87;
var overtext = Colors.white;
//starting of main page
class MainPage extends StatefulWidget {
const MainPage({super.key});
@override
State<MainPage> createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
//current colors to set in page
var currbg = defaultBg;
var currbutton = buttoncolor;
var currtext = nortext;
var cal = overtext;
//strings which will change over time
String title = 'BMI App';
String subtitle = 'Calculate your BMI';
//variable used in page
late int? result;
late double res;
late double? w;
late double? h;
String dropdownValue = 'Male';
//controllers for input
final _weightcontroller = TextEditingController();
final _heightcontroller = TextEditingController();
final _agecontroller = TextEditingController();
//int value fpr reset button
bool reset = false;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: currbg,
body: Container(
padding: const EdgeInsets.all(12.0),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
height: 0,
),
Text(title,
style: GoogleFonts.lato(
fontSize: 70,
fontWeight: FontWeight.w500,
color: currtext,
)),
const SizedBox(
height: 10,
),
Text(
subtitle,
style: GoogleFonts.lato(
fontSize: 26,
fontWeight: FontWeight.normal,
color: currtext,
),
),
const SizedBox(
height: 75,
),
Row(
children: [
Expanded(
child: TextFormField(
controller: _agecontroller,
keyboardType: const TextInputType.numberWithOptions(
decimal: true, signed: false),
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.allow(
RegExp(r'^\d+\.?\d{0,2}'))
],
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: currtext),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: currtext),
),
label: Text(
'Age',
style:
GoogleFonts.lato(color: currtext, fontSize: 20),
),
),
),
),
const SizedBox(
width: 20,
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(top: 18),
child: DropdownButton<String>(
alignment: Alignment.center,
underline: const SizedBox(),
isExpanded: true,
value: dropdownValue,
items: <String>['Male', 'Female', 'Others']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: GoogleFonts.lato(
color: nortext, fontSize: 20),
),
);
}).toList(),
onChanged: (String? newValue) {
setState(
() {
dropdownValue = newValue!;
},
);
},
),
),
),
],
),
const SizedBox(
height: 20,
),
Row(
children: [
Expanded(
child: TextFormField(
keyboardType: const TextInputType.numberWithOptions(
decimal: true, signed: false),
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.allow(
RegExp(r'^\d+\.?\d{0,2}'))
],
controller: _weightcontroller,
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: currtext),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: currtext),
),
label: Text(
'Weight(kg)',
style: GoogleFonts.lato(
color: currtext,
fontSize: 20,
),
),
),
),
),
const SizedBox(
width: 20,
),
Expanded(
child: TextFormField(
keyboardType: const TextInputType.numberWithOptions(
decimal: true, signed: false),
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.allow(RegExp(
(r'^(?!300)(?:\d{1,2}|1\d{2}|2[0-9]{2})(?:\.\d{0,2})?$')))
],
controller: _heightcontroller,
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: currtext),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: currtext),
),
label: Text(
'Height(cm)',
style: GoogleFonts.lato(
color: currtext,
fontSize: 20,
),
),
),
),
)
],
),
const SizedBox(
height: 100,
),
Center(
child: SizedBox(
height: 50,
width: 250.0,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: currbutton,
),
//processing of data
onPressed: () {
if (_agecontroller.text.isEmpty ||
_heightcontroller.text.isEmpty ||
_weightcontroller.text.isEmpty) {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(24.0))),
title: const Text("Hey!"),
content: const Text("You forgot to fill something"),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Container(
decoration: BoxDecoration(
color: currbg,
borderRadius: const BorderRadius.all(
Radius.circular(14.0))),
// color: currbg,
padding: const EdgeInsets.all(14),
child: const Text(
"Okay",
style: TextStyle(color: Colors.black87),
),
),
),
],
),
);
} else if (_agecontroller.text.length > 6 ||
_agecontroller.text == '0') {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(24.0))),
title: const Text("Hey!"),
content: const Text("Something wrong with the age"),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Container(
decoration: BoxDecoration(
color: currbg,
borderRadius: const BorderRadius.all(
Radius.circular(14.0))),
// color: currbg,
padding: const EdgeInsets.all(14),
child: const Text(
"Okay!",
style: TextStyle(color: Colors.black87),
),
),
),
],
),
);
} else if (_weightcontroller.text.length > 6 ||
_weightcontroller.text == '0') {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(24.0))),
title: const Text("Hey!"),
content:
const Text("Something wrong with the weight"),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Container(
decoration: BoxDecoration(
color: currbg,
borderRadius: const BorderRadius.all(
Radius.circular(14.0))),
// color: currbg,
padding: const EdgeInsets.all(14),
child: const Text(
"Okay!",
style: TextStyle(color: Colors.black87),
),
),
),
],
),
);
} else if (_heightcontroller.text.length > 6 ||
_heightcontroller.text == '0') {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(24.0))),
title: const Text("Hey!"),
content: const Text("Something wrong with height"),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Container(
decoration: BoxDecoration(
color: currbg,
borderRadius: const BorderRadius.all(
Radius.circular(14.0))),
// color: currbg,
padding: const EdgeInsets.all(14),
child: const Text(
"Okay!",
style: TextStyle(color: Colors.black87),
),
),
),
],
),
);
}
//if everything works fine then, app shows the result[BMI]
else {
setState(() {
w = double.tryParse(_weightcontroller.text);
h = double.tryParse(_heightcontroller.text);
res = calc(w!, h!);
});
if (res < 18.5) {
//underweight
setState(() {
cal = nortext;
currtext = overtext;
currbg = underweight;
currbutton = resbutton;
title = res.toInt().toString();
subtitle = 'Time to eat some healthy snacks!';
reset = true;
});
} else if (res > 25) {
//overweight
setState(() {
cal = nortext;
currtext = overtext;
currbg = overweight;
currbutton = resbutton;
title = res.toInt().toString();
subtitle = 'Time to discover a lighter life';
reset = true;
});
} else {
//normal
setState(() {
cal = nortext;
currbg = normal;
currbutton = resbutton;
title = res.toInt().toString();
subtitle = 'You\'re doing well!';
reset = true;
});
}
}
},
child: Text(
'Calculate',
style: GoogleFonts.lato(fontSize: 26, color: cal),
),
),
),
),
Container(
child: reset
? Center(
child: Padding(
padding: const EdgeInsets.only(top: 10.0),
child: TextButton(
style: ElevatedButton.styleFrom(
backgroundColor: currbutton),
onPressed: () {
setState(() {
title = 'BMI App';
subtitle = 'Calculate your BMI';
currbg = defaultBg;
currbutton = buttoncolor;
currtext = nortext;
cal = overtext;
_agecontroller.clear();
_heightcontroller.clear();
_weightcontroller.clear();
reset = false;
});
},
child: Text(
'Reset',
style: GoogleFonts.lato(color: cal),
),
),
),
)
: null),
],
),
),
),
);
}
}
//function to calculate BMI
double calc(double w, double h) {
double l = h / 100;
double bmi = w / (l * l);
return bmi;
}
| 0 |
mirrored_repositories/bmi_app | mirrored_repositories/bmi_app/lib/main.dart | import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'mainpage.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
//this is done to lock the orientation of the app so that it doesn't rotate when device is rotated.
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'BMI App',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MainPage(),
);
}
}
| 0 |
mirrored_repositories/bmi_app | mirrored_repositories/bmi_app/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:bmi_app/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/delivery-food-app-flutter | mirrored_repositories/delivery-food-app-flutter/lib/main.dart | import 'package:flutter/material.dart';
import 'package:food_delivery_app/pages/food/popular_food_detail.dart';
import 'package:food_delivery_app/pages/food/recomended_food_detail.dart';
import 'package:food_delivery_app/pages/home%20page/food_page_body.dart';
import 'package:food_delivery_app/pages/home%20page/main_food_page.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const RecomendedFoodDetail(),
);
}
}
| 0 |
mirrored_repositories/delivery-food-app-flutter/lib | mirrored_repositories/delivery-food-app-flutter/lib/widgets/small_text.dart | import 'package:flutter/cupertino.dart';
import 'package:food_delivery_app/utils/colors.dart';
class SmallText extends StatelessWidget{
Color? paramColor; //pass a color variable
final String paramText;
double paramSize;
double paramHeight;
SmallText({
Key? key,
this.paramColor = const Color.fromARGB(255, 77, 76, 75), //default color
required this.paramText,
this.paramSize = 14,
this.paramHeight = 1.1
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Text(
paramText,
style: TextStyle(
color: paramColor,
fontFamily: 'Poppins',
fontSize: paramSize,
height: paramHeight
),
);
}
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib | mirrored_repositories/delivery-food-app-flutter/lib/widgets/big_text.dart | import 'package:flutter/cupertino.dart';
import 'package:food_delivery_app/utils/colors.dart';
import 'package:food_delivery_app/utils/dimension.dart';
class BigText extends StatelessWidget{
Color? paramColor; //pass a color variable
final String paramText;
double paramSize;
TextOverflow paramOverFlow;
BigText({
Key? key,
this.paramColor = const Color(0xFF332d2b), //default color
required this.paramText,
this.paramOverFlow = TextOverflow.ellipsis,
this.paramSize = 0
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Text(
paramText,
maxLines: 1,
overflow: paramOverFlow,
style: TextStyle(
color: paramColor,
fontWeight: FontWeight.w500,
fontFamily: 'Poppins',
fontSize: paramSize == 0 ? Dimensions.font18 : paramSize,
),
);
}
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib | mirrored_repositories/delivery-food-app-flutter/lib/widgets/icon_and_text_widget.dart | import 'package:flutter/cupertino.dart';
import 'package:food_delivery_app/utils/dimension.dart';
import 'package:food_delivery_app/widgets/small_text.dart';
class IconAndTextWidget extends StatelessWidget{
final IconData icon; //we cannt pass icon, but we can do this instead
final Color iconColor;
final String text;
final double iconSize;
const IconAndTextWidget({Key? key, required this.icon, required this.text, required this.iconColor, required this.iconSize}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, color:iconColor, size: iconSize,),
const SizedBox(width: 5,),
SmallText(paramText: text,)
],
);
}
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib | mirrored_repositories/delivery-food-app-flutter/lib/widgets/app_column.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:food_delivery_app/utils/colors.dart';
import 'package:food_delivery_app/utils/dimension.dart';
import 'package:food_delivery_app/widgets/big_text.dart';
import 'package:food_delivery_app/widgets/icon_and_text_widget.dart';
import 'package:food_delivery_app/widgets/small_text.dart';
class AppColumn extends StatelessWidget{
final String text;
const AppColumn({Key? key, required this.text}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BigText(paramText: text,),
SizedBox(height: Dimensions.height10),
Row(
children: [
Wrap(
children: List.generate(5, (index) => Icon(Icons.star, color: AppColors.mainColor, size: 15,))
),
SizedBox(width: 10,),
SmallText(paramText: '4.5'),
SizedBox(width: 10,),
SmallText(paramText: '1298'),
SizedBox(width: 5,),
SmallText(paramText: 'comments'),
],
),
SizedBox(height: Dimensions.height20,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconAndTextWidget(
icon: Icons.circle_sharp,
text: 'Normal',
iconColor: AppColors.iconColor1, iconSize: Dimensions.iconSize24,
),
IconAndTextWidget(
icon: Icons.location_on,
text: '1.7km',
iconColor: AppColors.mainColor, iconSize: Dimensions.iconSize24,
),
IconAndTextWidget(
icon: Icons.access_time,
text: '32 mins',
iconColor: AppColors.iconColor2, iconSize: Dimensions.iconSize24,
),
],
)
],
);
}
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib | mirrored_repositories/delivery-food-app-flutter/lib/widgets/expandable_text_widget.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:food_delivery_app/utils/colors.dart';
import 'package:food_delivery_app/utils/dimension.dart';
import 'package:food_delivery_app/widgets/small_text.dart';
class ExpandableTextWidget extends StatefulWidget{
final String text;
const ExpandableTextWidget({Key? key, required this.text}) : super(key: key);
@override
State<ExpandableTextWidget> createState() => _ExpandableTextWidgetState();
}
class _ExpandableTextWidgetState extends State<ExpandableTextWidget> {
late String firstHalf;
late String secondHalf;
bool hiddenText = true;
double textHeight = Dimensions.screenHeight / 3.63; //if total text is more than 200, we'll hide the rest of the text
@override
void initState(){
super.initState();
//check length of text that passed
//if length of text is > 200, then split the whole text into 2 section
if(widget.text.length > textHeight){
firstHalf = widget.text.substring(0, textHeight.toInt());
secondHalf = widget.text.substring(textHeight.toInt() + 1, widget.text.length);
}else {
firstHalf = widget.text;
secondHalf = "";
}
}
@override
Widget build(BuildContext context) {
return Container(
child: secondHalf.isEmpty? SmallText(paramText: firstHalf) : Column(
children: [
//first half
SmallText(
paramText: hiddenText? ("$firstHalf...") : (firstHalf + secondHalf),
paramSize: Dimensions.font16,
paramHeight: 1.3,
),
SizedBox(height: Dimensions.height10,),
//button
InkWell(
onTap: (){
setState(() {
hiddenText = !hiddenText;
});
},
child: Row(
children: [
SmallText(
paramText: hiddenText? 'Show more' : 'Show less',
paramColor: AppColors.mainColor
),
Icon(
hiddenText? Icons.arrow_drop_down : Icons.arrow_drop_up,
color: AppColors.mainColor
)
],
),
),
],
),
);
}
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib | mirrored_repositories/delivery-food-app-flutter/lib/widgets/app_icon.dart | import 'package:flutter/cupertino.dart';
import 'package:food_delivery_app/utils/dimension.dart';
class AppIcon extends StatelessWidget{
final IconData icon;
final Color backgroudColor;
final Color iconColor;
final double size;
final double iconSize;
const AppIcon({
Key? key,
required this.icon,
this.backgroudColor = const Color.fromARGB(206, 252, 244, 228),
this.iconColor = const Color(0xFF756d54),
this.size = 40,
this.iconSize = 16,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: size,
height: size,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(size/2),
color: backgroudColor
),
child: Icon(
icon,
color: iconColor,
size: iconSize,
),
);
}
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib/pages | mirrored_repositories/delivery-food-app-flutter/lib/pages/home page/food_page_body.dart | import 'package:dots_indicator/dots_indicator.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:food_delivery_app/utils/colors.dart';
import 'package:food_delivery_app/utils/dimension.dart';
import 'package:food_delivery_app/widgets/app_column.dart';
import 'package:food_delivery_app/widgets/big_text.dart';
import 'package:food_delivery_app/widgets/icon_and_text_widget.dart';
import 'package:food_delivery_app/widgets/small_text.dart';
class FoodPageBody extends StatefulWidget{
const FoodPageBody({Key? key}) : super(key: key);
@override
State<FoodPageBody> createState() => _FoodPageBodyState();
}
class _FoodPageBodyState extends State<FoodPageBody> {
PageController pageController = PageController(
viewportFraction: 0.85
);
var _currPageVal = 0.0;
double _scaleFactor = 0.8;
double _height = Dimensions.pageViewContainer;
@override //1. initialise necessary things that your page should need
void initState(){ //method in stateful class
super.initState();
pageController.addListener(() {
setState(() {
_currPageVal = pageController.page!; //get curr page val
// print(_currPageVal.toString());
});
});
}
@override //2. when you leave the page you dispose them, coz u dont need it anymore
void dispose(){
pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
children: [
//carousel
Container(
height: Dimensions.pageView,
child: PageView.builder(
controller: pageController,
itemCount: 5, //position will connected to item count, position is an index, so it will to be 0 - 4
itemBuilder: (context, position){
return _buildPageItem(position);
}),
),
//dot
DotsIndicator(
dotsCount: 5,
position: _currPageVal,
decorator: DotsDecorator(
activeColor: AppColors.mainColor,
size: const Size.square(9.0),
activeSize: const Size(18.0, 9.0),
activeShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0)),
),
),
//popular text
SizedBox(height: Dimensions.height30),
Container(
margin: EdgeInsets.only(left: Dimensions.width20, bottom: Dimensions.height20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
BigText(paramText: 'Popular'),
SizedBox(width: Dimensions.width10),
Container(
margin: const EdgeInsets.only(bottom: 3),
child: BigText(paramText: '.', paramColor: Colors.black26,),
),
SizedBox(width: Dimensions.width10),
Container(
margin: const EdgeInsets.only(bottom: 4),
child: SmallText(paramText: 'Food Pairing'),
),
],
),
),
//list of food and images
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: 10,
itemBuilder: (context, index){
return Container(
margin: EdgeInsets.only(left: Dimensions.width20, right: Dimensions.width20, bottom: Dimensions.height10),
child: Row(
children: [
//image section
Container(
width: Dimensions.image90,
height: Dimensions.image90,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius10),
color: Colors.white38,
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage(
"image/food01.jpg"
),
),
),
),
//detail section
Expanded( //to make width take all of available space
child: Container(
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(Dimensions.radius10),
bottomRight: Radius.circular(Dimensions.radius10)
),
boxShadow: const [
BoxShadow(
color: Color.fromARGB(255, 203, 200, 200),
blurRadius: 2.0,
offset: Offset(0, 5),
),
],
color: Colors.white,
),
child: Padding(
padding: EdgeInsets.only(left: Dimensions.width10, right: Dimensions.width10),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BigText(paramText: 'Chicken Noodle Soup with the Soda on the side', paramSize: 16,),
SmallText(paramText: 'Good soup'),
SizedBox(height: Dimensions.height10,),
Wrap(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconAndTextWidget(
icon: Icons.circle_sharp,
text: 'Normal',
iconColor: AppColors.iconColor1, iconSize: Dimensions.iconSize12,
),
IconAndTextWidget(
icon: Icons.location_on,
text: '1.7km',
iconColor: AppColors.mainColor, iconSize: Dimensions.iconSize12,
),
IconAndTextWidget(
icon: Icons.access_time,
text: '32 mins',
iconColor: AppColors.iconColor2, iconSize: Dimensions.iconSize12,
),
],
),
],
)
],
),
),
),
),
],
),
);
}
)
],
);
}
Widget _buildPageItem(int position) {
//scalling pict
Matrix4 matrix = Matrix4.identity();
if(position == _currPageVal.floor()){ //current slide
var currScale = 1-(_currPageVal - position) * (1 - _scaleFactor);
var currTrans = _height * (1 - currScale) / 2;
matrix = Matrix4.diagonal3Values(1, currScale, 1)..setTranslationRaw(0, currTrans, 0);
}
else if(position == _currPageVal.floor() + 1){ //next slide
var currScale = _scaleFactor + (_currPageVal - position + 1) * (1 - _scaleFactor);
var currTrans = _height * (1 - currScale) / 2;
matrix = Matrix4.diagonal3Values(1, currScale, 1);
matrix = Matrix4.diagonal3Values(1, currScale, 1)..setTranslationRaw(0, currTrans, 0);
}
else if(position == _currPageVal.floor() - 1){ // previous slide
var currScale = 1-(_currPageVal - position) * (1 - _scaleFactor);
var currTrans = _height * (1 - currScale) / 2;
matrix = Matrix4.diagonal3Values(1, currScale, 1);
matrix = Matrix4.diagonal3Values(1, currScale, 1)..setTranslationRaw(0, currTrans, 0);
}
else{ //the pict after current pict
var currScale = 0.8;
matrix = Matrix4.diagonal3Values(1, currScale, 1)..setTranslationRaw(0, _height * (1 - _scaleFactor) / 2, 0);
}
return Transform(
transform: matrix,
child: Stack(
children: [
// Carousel images
Container(
height: Dimensions.pageViewContainer,
margin: EdgeInsets.only(left: Dimensions.width10, right: Dimensions.width10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius20),
color: position.isEven? Color(0xFF69c5df) : Color(0xFF9294cc),
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage(
"image/food01.jpg",
)
),
),
),
// Box Information
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: Dimensions.pageViewTextContainer,
padding: EdgeInsets.only(top: Dimensions.height10, left: Dimensions.width15, right: Dimensions.width15),
margin: EdgeInsets.only(left: Dimensions.width15, right: Dimensions.width15, bottom: Dimensions.height30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius20),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Color.fromARGB(255, 190, 190, 190),
blurRadius: 3.0,
offset: Offset(0, 5),
),
BoxShadow(
color: Colors.white,
offset: Offset(5, 0),
),
BoxShadow(
color: Colors.white,
offset: Offset(-5, 0),
),
],
),
//Text Information
child: AppColumn(text: 'Chicken Noodle Soup',)
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/delivery-food-app-flutter/lib/pages | mirrored_repositories/delivery-food-app-flutter/lib/pages/home page/main_food_page.dart | // ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
import 'package:food_delivery_app/pages/home%20page/food_page_body.dart';
import 'package:food_delivery_app/utils/colors.dart';
import 'package:food_delivery_app/utils/dimension.dart';
import 'package:food_delivery_app/widgets/big_text.dart';
import 'package:food_delivery_app/widgets/small_text.dart';
class MainFoodPage extends StatefulWidget{
const MainFoodPage({Key? key}) : super(key: key);
@override
State<MainFoodPage> createState() => _MainFoodPageState();
}
class _MainFoodPageState extends State<MainFoodPage> {
@override
Widget build(BuildContext context) {
// print('Current height : ' + MediaQuery.of(context).size.width.toString());
return Scaffold(
body: Column(
children: [
// header
Container(
margin: EdgeInsets.only(top: Dimensions.height45, bottom: Dimensions.height15),
padding: EdgeInsets.only(left: Dimensions.width20, right: Dimensions.width20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
BigText(paramText: 'Indonesia', paramColor: AppColors.mainColor,),
Row(
children: [
SmallText( paramText: 'Jakarta', paramColor: Colors.black,),
Icon(Icons.arrow_drop_down)
],
)
],
),
//icon
Center(
child: Container(
width: Dimensions.height45,
height: Dimensions.height45,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius10),
color: AppColors.mainColor,
),
child: Icon(
Icons.search,
color: Colors.white,
size: Dimensions.iconSize24,
),
),
),
],
),
),
// body
Expanded(
child: SingleChildScrollView(
child: FoodPageBody()
)
),
],
),
);
}
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib/pages | mirrored_repositories/delivery-food-app-flutter/lib/pages/food/recomended_food_detail.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:food_delivery_app/utils/colors.dart';
import 'package:food_delivery_app/utils/dimension.dart';
import 'package:food_delivery_app/widgets/app_icon.dart';
import 'package:food_delivery_app/widgets/big_text.dart';
import 'package:food_delivery_app/widgets/expandable_text_widget.dart';
import 'package:food_delivery_app/widgets/small_text.dart';
class RecomendedFoodDetail extends StatelessWidget{
const RecomendedFoodDetail({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: [
SliverAppBar(
toolbarHeight: 100,
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppIcon(icon: Icons.clear,),
AppIcon(icon: Icons.shopping_cart_outlined),
],
),
bottom: PreferredSize(
preferredSize: Size.fromHeight(40),
child: Container(
padding: EdgeInsets.only(top: Dimensions.height10, bottom: Dimensions.height10, left: Dimensions.width10, right: Dimensions.width10),
width: double.maxFinite,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(topLeft: Radius.circular(Dimensions.height10), topRight: Radius.circular(Dimensions.height10) )
),
child: Center(
child: BigText(paramText: 'Chicken Noodle Soup',)
),
),
),
pinned: true,
backgroundColor: AppColors.yellowColor,
expandedHeight: 300,
flexibleSpace: FlexibleSpaceBar( //for background image
background: Image.asset(
'image/food04.jpg',
width: double.maxFinite,
fit: BoxFit.cover,
),
),
),
SliverToBoxAdapter(
child: Container(
margin: EdgeInsets.only(left: Dimensions.width20, right: Dimensions.width20),
color: Colors.white,
child: Column(
children: [
ExpandableTextWidget(text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Donec adipiscing tristique risus nec feugiat in fermentum. Penatibus et magnis dis parturient montes nascetur ridiculus mus. Malesuada fames ac turpis egestas integer. In ante metus dictum at tempor commodo ullamcorper a. Congue quisque egestas diam in. Ultricies mi quis hendrerit dolor magna eget est lorem ipsum. Sit amet nisl purus in mollis nunc sed. Feugiat pretium nibh ipsum consequat. Integer vitae justo eget magna fermentum iaculis eu. Massa sed elementum tempus egestas sed sed risus. Ipsum nunc aliquet bibendum enim facilisis. Turpis massa sed elementum tempus. Ac turpis egestas sed tempus urna et pharetra pharetra massa. Sed faucibus turpis in eu mi. Risus at ultrices mi tempus imperdiet nulla malesuada. Vulputate sapien nec sagittis aliquam. Auctor neque vitae tempus quam pellentesque nec nam. Convallis posuere morbi leo urna molestie at elementum eu facilisis. Vel turpis nunc eget lorem. Pellentesque habitant morbi tristique senectus et. Amet massa vitae tortor condimentum lacinia quis. Duis at tellus at urna condimentum. Enim tortor at auctor urna nunc id cursus metus aliquam. Faucibus vitae aliquet nec ullamcorper sit amet risus nullam eget. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Donec adipiscing tristique risus nec feugiat in fermentum. Penatibus et magnis dis parturient montes nascetur ridiculus mus. Malesuada fames ac turpis egestas integer. In ante metus dictum at tempor commodo ullamcorper a. Congue quisque egestas diam in. Ultricies mi quis hendrerit dolor magna eget est lorem ipsum. Sit amet nisl purus in mollis nunc sed. Feugiat pretium nibh ipsum consequat. Integer vitae justo eget magna fermentum iaculis eu. Massa sed elementum tempus egestas sed sed risus. Ipsum nunc aliquet bibendum enim facilisis. Turpis massa sed elementum tempus. Ac turpis egestas sed tempus urna et pharetra pharetra massa. Sed faucibus turpis in eu mi. Risus at ultrices mi tempus imperdiet nulla malesuada. Vulputate sapien nec sagittis aliquam. Auctor neque vitae tempus quam pellentesque nec nam. Convallis posuere morbi leo urna molestie at elementum eu facilisis. Vel turpis nunc eget lorem. Pellentesque habitant morbi tristique senectus et. Amet massa vitae tortor condimentum lacinia quis. Duis at tellus at urna condimentum. Enim tortor at auctor urna nunc id cursus metus aliquam. Faucibus vitae aliquet nec ullamcorper sit amet risus nullam eget.')
],
)
),
),
],
),
bottomNavigationBar: Column (
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: EdgeInsets.only(top: Dimensions.height10, bottom: Dimensions.height10, left: Dimensions.width30, right: Dimensions.width30),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
AppIcon(icon: Icons.remove, backgroudColor: AppColors.mainColor, iconColor: Colors.white, iconSize: Dimensions.iconSize24,),
BigText(paramText: '\$12.88 X 0', paramSize: Dimensions.font22,),
AppIcon(icon: Icons.add, backgroudColor: AppColors.mainColor, iconColor: Colors.white, iconSize: Dimensions.iconSize24,)
],
),
),
Container(
height: Dimensions.bottomHeightBar,
padding: EdgeInsets.only(top: Dimensions.height15, bottom: Dimensions.height15, left: Dimensions.width30, right: Dimensions.width30),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(Dimensions.radius30),
topRight: Radius.circular(Dimensions.radius30)
),
color: Color.fromARGB(255, 219, 218, 217)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: EdgeInsets.only(top: Dimensions.height10, bottom: Dimensions.height10, left: Dimensions.width10, right: Dimensions.width10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius20),
color: Colors.white
),
child: AppIcon(icon: Icons.favorite, iconColor: AppColors.mainColor, iconSize: Dimensions.iconSize36, backgroudColor: Colors.white,),
),
Container(
padding: EdgeInsets.only(top: Dimensions.height20, bottom: Dimensions.height20, left: Dimensions.width20, right: Dimensions.width20),
decoration: BoxDecoration(
color: AppColors.mainColor,
borderRadius: BorderRadius.circular(Dimensions.radius20)
),
child: BigText(
paramText: '\$10 | Add to cart',
paramColor: Colors.white,
paramSize: Dimensions.font16,
),
),
],
),
),
],
),
);
}
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib/pages | mirrored_repositories/delivery-food-app-flutter/lib/pages/food/popular_food_detail.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:food_delivery_app/utils/colors.dart';
import 'package:food_delivery_app/utils/dimension.dart';
import 'package:food_delivery_app/widgets/app_column.dart';
import 'package:food_delivery_app/widgets/app_icon.dart';
import 'package:food_delivery_app/widgets/big_text.dart';
import 'package:food_delivery_app/widgets/expandable_text_widget.dart';
import 'package:food_delivery_app/widgets/icon_and_text_widget.dart';
import 'package:food_delivery_app/widgets/small_text.dart';
class PopularFoodDetail extends StatelessWidget{
const PopularFoodDetail({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Stack(
children: [
Positioned( //img
left: 0,
right: 0,
child: Container(
width: double.maxFinite, //take available width
height: Dimensions.popFoodImg250,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage(
"image/food03.jpg"
),
)
),
)
),
Positioned( //icon widget
top: Dimensions.height30,
left: Dimensions.width20,
right: Dimensions.width20,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppIcon(icon: Icons.arrow_back_ios),
AppIcon(icon: Icons.shopping_cart_outlined,)
],
)
),
Positioned( //about
right: 0,
left: 0,
bottom: 0,
top: Dimensions.popFoodImg250 - Dimensions.height20,
child: Container(
padding: EdgeInsets.only(left: Dimensions.width20, right: Dimensions.width20, top: Dimensions.height20),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(Dimensions.radius20),
topRight: Radius.circular(Dimensions.radius20)
),
color: Colors.white,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppColumn(text: 'Chicken Noodle Soup'),
SizedBox(height: Dimensions.height30),
//about
BigText(paramText: 'About',),
SizedBox(height: Dimensions.height10),
// expandable text widget
Expanded(
child: SingleChildScrollView(
child: ExpandableTextWidget(
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Donec adipiscing tristique risus nec feugiat in fermentum. Penatibus et magnis dis parturient montes nascetur ridiculus mus. Malesuada fames ac turpis egestas integer. In ante metus dictum at tempor commodo ullamcorper a. Congue quisque egestas diam in. Ultricies mi quis hendrerit dolor magna eget est lorem ipsum. Sit amet nisl purus in mollis nunc sed. Feugiat pretium nibh ipsum consequat. Integer vitae justo eget magna fermentum iaculis eu. Massa sed elementum tempus egestas sed sed risus. Ipsum nunc aliquet bibendum enim facilisis. Turpis massa sed elementum tempus. Ac turpis egestas sed tempus urna et pharetra pharetra massa. Sed faucibus turpis in eu mi. Risus at ultrices mi tempus imperdiet nulla malesuada. Vulputate sapien nec sagittis aliquam. Auctor neque vitae tempus quam pellentesque nec nam. Convallis posuere morbi leo urna molestie at elementum eu facilisis. Vel turpis nunc eget lorem. Pellentesque habitant morbi tristique senectus et. Amet massa vitae tortor condimentum lacinia quis. Duis at tellus at urna condimentum. Enim tortor at auctor urna nunc id cursus metus aliquam. Faucibus vitae aliquet nec ullamcorper sit amet risus nullam eget.'
)
)
)
],
)
)
),
],
),
bottomNavigationBar: Container(
height: Dimensions.bottomHeightBar,
padding: EdgeInsets.only(top: Dimensions.height15, bottom: Dimensions.height15, left: Dimensions.width15, right: Dimensions.width15),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(Dimensions.radius30),
topRight: Radius.circular(Dimensions.radius30)
),
color: Color.fromARGB(255, 219, 218, 217)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: EdgeInsets.only(top: Dimensions.height20, bottom: Dimensions.height20, left: Dimensions.width20, right: Dimensions.width20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius20),
color: Colors.white
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(Icons.remove, color: AppColors.signColor,),
SizedBox(width: Dimensions.width10),
BigText(paramText: '0', paramSize: Dimensions.font16,),
SizedBox(width: Dimensions.width10),
Icon(Icons.add, color: AppColors.signColor,)
],
),
),
Container(
padding: EdgeInsets.only(top: Dimensions.height20, bottom: Dimensions.height20, left: Dimensions.width20, right: Dimensions.width20),
decoration: BoxDecoration(
color: AppColors.mainColor,
borderRadius: BorderRadius.circular(Dimensions.radius20)
),
child: BigText(
paramText: '\$10 | Add to cart',
paramColor: Colors.white,
paramSize: Dimensions.font16,
),
),
],
),
),
);
}
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib | mirrored_repositories/delivery-food-app-flutter/lib/utils/colors.dart | import 'dart:ui';
class AppColors{
static const Color textColor = Color(0xFFccc7c5);
static const Color mainColor = Color.fromARGB(255, 72, 128, 121);
static const Color iconColor1 = Color(0xFFffd28d);
static const Color iconColor2 = Color(0xFFfcab88);
static const Color paraColor = Color(0xFF8f837f);
static const Color buttonBackgroundColor = Color(0xFFf7f6f4);
static const Color signColor = Color(0xFFa9a29f);
static const Color titleColor = Color(0xFF5c524f);
static const Color mainBlackColor = Color(0xFF332d2b);
static const Color yellowColor = Color(0xFFffd379);
} | 0 |
mirrored_repositories/delivery-food-app-flutter/lib | mirrored_repositories/delivery-food-app-flutter/lib/utils/dimension.dart | import 'package:get/get.dart';
class Dimensions {
static double screenHeight = Get.context!.height;
static double screenWidth = Get.context!.width;
// 667 / 320 = 2.08
static double pageView = screenHeight/2.08;
// 667 / 220 = 3.03;
static double pageViewContainer = screenHeight/3.03;
// 667 / 120 = 5.53
static double pageViewTextContainer = screenHeight/5.53;
// dynamic height for padding and margin
// 667 / 10, 15, 20 = 66.7
static double height10 = screenHeight/66.7;
static double height15 = screenHeight/44.4;
static double height20 = screenHeight/33.3;
static double height30 = screenHeight/22.2;
static double height45 = screenHeight/14.8;
// dynamic width for padding and margin
//width = 412
static double width10 = screenWidth/41.2;
static double width15 = screenWidth/27.5;
static double width20 = screenWidth/20.6;
static double width30 = screenWidth/13.7;
static double width45 = screenWidth/9.15;
// 667 / 20 = 33.35
static double font16 = screenHeight/41.7;
static double font18 = screenHeight/33.3;
static double font22 = screenHeight/30.3;
static double radius20 = screenHeight/33.3;
static double radius10 = screenHeight/66.7;
static double radius30 = screenHeight/22.2;
static double iconSize36 = screenHeight/18.5;
static double iconSize24 = screenHeight/27.8;
static double iconSize16 = screenHeight/41.7;
static double iconSize12 = screenHeight/55.6;
//image
static double image90 = screenHeight / 7.41;
static double popFoodImg250 = screenHeight / 2.67;
//detail image
//bottom height
static double bottomHeightBar = screenHeight / 6.67;
} | 0 |
mirrored_repositories/delivery-food-app-flutter | mirrored_repositories/delivery-food-app-flutter/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:food_delivery_app/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/flutter_riverpod_template | mirrored_repositories/flutter_riverpod_template/lib/my_app.dart | import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_riverpod_template/feature/shared/navigation/app_router.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_theme.dart';
class MyApp extends ConsumerStatefulWidget {
const MyApp({
required this.launchTitle,
Key? key,
}) : super(key: key);
final String launchTitle;
@override
ConsumerState<MyApp> createState() => _MyAppState();
}
class _MyAppState extends ConsumerState<MyApp> {
final _appRouter = AppRouter();
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: widget.launchTitle,
// theme settings
theme: AppThemes.appTheme(Brightness.light),
darkTheme: AppThemes.appTheme(Brightness.dark),
themeMode: ThemeMode.light, // TODO base on condtion chage it
// use auto router to decide widget
routerConfig: _appRouter.config(),
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib | mirrored_repositories/flutter_riverpod_template/lib/main/main_mock_development.dart | import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_riverpod_template/feature/shared/app_flavour/app_config.dart';
import 'package:flutter_riverpod_template/data/remote/api/providers/user/mock_user_repository_provider.dart';
import 'package:flutter_riverpod_template/data/remote/api/providers/user/user_repository_provider.dart';
import 'package:flutter_riverpod_template/data/remote/api_url_configuration.dart';
import 'package:flutter_riverpod_template/feature/shared/app_flavour/shared_main.dart';
void main() async {
// different for each flavours
final appConfig = AppConfig(
// just test with dev
environment: AppEnvironment.dev,
apiBaseUrl: DevBaseUrl.baseUrlDev,
appApiKey: DevBaseUrl.appApiKey,
launchTitle: 'Mock',
initializeCrashlytics: false,
);
// different for each flavours
final List<Override> overrides = [
// override any specific depedency needed
// override any specific depedency needed for mock
// override for testing with hard coded data
userRepositoryProvider.overrideWith(
(ref) => MockUserRepository(),
),
];
sharedMain(overrides: overrides, appConfig);
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib | mirrored_repositories/flutter_riverpod_template/lib/main/main_prod.dart | import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_riverpod_template/feature/shared/app_flavour/app_config.dart';
import 'package:flutter_riverpod_template/data/remote/api_url_configuration.dart';
import 'package:flutter_riverpod_template/feature/shared/app_flavour/shared_main.dart';
void main() async {
// different for each flavours
final appConfig = AppConfig(
environment: AppEnvironment.prod,
apiBaseUrl: ProdBaseUrl.baseUrlDev,
appApiKey: ProdBaseUrl.appApiKey,
launchTitle: 'Prod',
initializeCrashlytics: true,
);
// different for each flavours
final List<Override> overrides = [
// override any specific depedency needed for staging
];
sharedMain(overrides: overrides, appConfig);
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib | mirrored_repositories/flutter_riverpod_template/lib/main/main_dev.dart | import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_riverpod_template/feature/shared/app_flavour/app_config.dart';
import 'package:flutter_riverpod_template/data/remote/api_url_configuration.dart';
import 'package:flutter_riverpod_template/feature/shared/app_flavour/shared_main.dart';
void main() async {
// different for each flavours
final appConfig = AppConfig(
environment: AppEnvironment.dev,
apiBaseUrl: DevBaseUrl.baseUrlDev,
appApiKey: DevBaseUrl.appApiKey,
launchTitle: 'Staging',
initializeCrashlytics: false,
);
// different for each flavours
final List<Override> overrides = [
// override any specific depedency needed for staging
];
sharedMain(overrides: overrides, appConfig);
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api_url_configuration.dart | class DevBaseUrl {
DevBaseUrl._();
static const baseUrlDev = 'https://api.github.com/'; // change dev url here
static const appApiKey = 'api key TODO';
}
class ProdBaseUrl {
ProdBaseUrl._();
static const baseUrlDev = 'https://api.github.com/'; // change prod url here
static const appApiKey = 'api key TODO';
}
class StageBaseUrl {
StageBaseUrl._();
static const baseUrlDev = 'https://api.github.com/'; // change staging url here
static const appApiKey = 'api key TODO';
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data/remote/api | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/cient/api_client.dart | import 'package:dio/dio.dart';
import 'package:flutter_riverpod_template/data/remote/api/cient/api_constants.dart';
import 'package:flutter_riverpod_template/feature/repository_list/models/repository_list_model.dart';
import 'package:retrofit/retrofit.dart';
part 'api_client.g.dart';
@RestApi()
abstract class ApiClient {
factory ApiClient(
Dio dio, {
String baseUrl,
}) = _ApiClient;
@GET("${ApiPath.users}/{username}/repos")
Future<List<RepositoryListModel>> getRepositories(
@Path("username") String username,
@Query("per_page") int pageSize,
);
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data/remote/api | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/cient/api_config.dart | class ApiConfig {
ApiConfig(this.baseUrl, {required this.apiKey});
final String baseUrl;
String get apiUrl => baseUrl;
final String apiKey;
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data/remote/api | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/cient/mock_api_client.dart | import 'package:dio/dio.dart';
import 'package:flutter_riverpod_template/data/remote/api/cient/api_client.dart';
final mockApiClient = ApiClient(Dio(), baseUrl: "");
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data/remote/api | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/cient/api_constants.dart | class ApiPath {
ApiPath._();
static const users = 'users';
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data/remote/api | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/cient/custom_log_interceptor.dart | import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
class CustomLoggerInterceptor implements Interceptor {
@override
void onError(DioException err, ErrorInterceptorHandler handler) {
debugPrint('API.................... onError()');
debugPrint('Error Url: ${err.requestOptions.uri}');
debugPrint('Error trace: ${err.stackTrace}');
debugPrint('Response Error: ${err.response?.data}');
return handler.next(err);
}
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
debugPrint(
'API.................... onRequest() - Sending network request');
debugPrint('URL: ${options.baseUrl}${options.path}');
debugPrint('Headers: ${options.headers}');
debugPrint('Query paramters: ${options.queryParameters}');
return handler.next(options);
}
@override
void onResponse(Response response, ResponseInterceptorHandler handler) {
debugPrint(
'API.................... onResponse() - Got response - RESPONSE:'
'Status Code: ${response.statusCode}'
'URL: ${response.requestOptions.baseUrl}${response.requestOptions.path} \n'
'Response Data: ${response.data}');
return handler.next(response);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data/remote/api | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/providers/api_client_provider.dart | import 'package:dio/dio.dart';
import 'package:flutter_riverpod_template/data/app_providers/app_provider.dart';
import 'package:flutter_riverpod_template/data/remote/api/cient/api_client.dart';
import 'package:flutter_riverpod_template/data/remote/api/cient/custom_log_interceptor.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'api_client_provider.g.dart';
@riverpod
ApiClient apiClient(ApiClientRef ref) {
final dio = Dio();
dio.interceptors.add(CustomLoggerInterceptor());
final provider = ref.read(appProvider);
// dio.options.headers = {'api-key': provider.apiKey};
return ApiClient(dio, baseUrl: provider.baseUrl);
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/providers | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/providers/user/user_repository_provider.dart | import 'package:flutter_riverpod_template/data/remote/api/providers/api_client_provider.dart';
import 'package:flutter_riverpod_template/data/remote/api/providers/user/user_repository.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'user_repository_provider.g.dart';
@riverpod
UserRepository userRepository(UserRepositoryRef ref) => UserRepository(
apiClient: ref.watch(apiClientProvider),
);
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/providers | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/providers/user/user_repository.dart | import 'package:flutter_riverpod_template/data/remote/api/cient/api_client.dart';
import 'package:flutter_riverpod_template/feature/repository_list/models/repository_list_model.dart';
class UserRepository {
UserRepository({required this.apiClient});
final ApiClient apiClient;
Future<List<RepositoryListModel>> getRepositories(String userName, int pageSize) =>
apiClient.getRepositories(userName, pageSize);
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/providers | mirrored_repositories/flutter_riverpod_template/lib/data/remote/api/providers/user/mock_user_repository_provider.dart | import 'package:flutter_riverpod_template/data/remote/api/cient/mock_api_client.dart';
import 'package:flutter_riverpod_template/data/remote/api/providers/user/user_repository.dart';
import 'package:flutter_riverpod_template/feature/repository_list/models/repository_list_model.dart';
class MockUserRepository extends UserRepository {
MockUserRepository() : super(apiClient: mockApiClient);
@override
Future<List<RepositoryListModel>> getRepositories(
String userName, int pageSize) async {
return hardCodedData;
}
}
final hardCodedData = [
RepositoryListModel(
id: 1,
nodeId: 'node1',
name: 'Repo 1',
fullName: 'Full Name 1',
isPrivate: false,
owner: Owner(
login: 'owner1',
id: 101,
nodeId: 'ownerNode1',
avatarUrl: 'owner_avatar_url1',
htmlUrl: 'owner_html_url1',
followersUrl: 'owner_followers_url1',
followingUrl: 'owner_following_url1',
gistsUrl: 'owner_gists_url1',
starredUrl: 'owner_starred_url1',
subscriptionsUrl: 'owner_subscriptions_url1',
organizationsUrl: 'owner_organizations_url1',
reposUrl: 'owner_repos_url1',
eventsUrl: 'owner_events_url1',
receivedEventsUrl: 'owner_received_events_url1',
type: 'owner_type1',
isSiteAdmin: false,
),
htmlUrl: 'html_url1',
description: 'Description 1',
isFork: true,
url: 'url1',
),
RepositoryListModel(
id: 2,
nodeId: 'node2',
name: 'Repo 2',
fullName: 'Full Name 2',
isPrivate: true,
owner: Owner(
login: 'owner2',
id: 102,
nodeId: 'ownerNode2',
avatarUrl: 'owner_avatar_url2',
htmlUrl: 'owner_html_url2',
followersUrl: 'owner_followers_url2',
followingUrl: 'owner_following_url2',
gistsUrl: 'owner_gists_url2',
starredUrl: 'owner_starred_url2',
subscriptionsUrl: 'owner_subscriptions_url2',
organizationsUrl: 'owner_organizations_url2',
reposUrl: 'owner_repos_url2',
eventsUrl: 'owner_events_url2',
receivedEventsUrl: 'owner_received_events_url2',
type: 'owner_type2',
isSiteAdmin: true,
),
htmlUrl: 'html_url2',
description: 'Description 2',
isFork: false,
url: 'url2',
),
];
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/data | mirrored_repositories/flutter_riverpod_template/lib/data/app_providers/app_provider.dart | import 'package:flutter_riverpod_template/data/remote/api/cient/api_config.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
final appProvider = Provider<ApiConfig>((ref) => ApiConfig('', apiKey: ''));
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature | mirrored_repositories/flutter_riverpod_template/lib/feature/shared/ui_constants.dart | 0 |
|
mirrored_repositories/flutter_riverpod_template/lib/feature/shared | mirrored_repositories/flutter_riverpod_template/lib/feature/shared/widgets/shared_app_bar.dart | import 'package:flutter/material.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_color.dart';
class SharedAppBar extends StatelessWidget implements PreferredSizeWidget {
const SharedAppBar({
Key? key,
required this.title,
}) : super(key: key);
final String title;
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: context.color.backgroundPrimary, // background color
foregroundColor: context.color.textPrimary, // text color
title: Text(title),
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/shared | mirrored_repositories/flutter_riverpod_template/lib/feature/shared/widgets/shared_sliver_app_bar.dart | import 'package:flutter/material.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_color.dart';
class SharedSliverAppBar extends StatelessWidget {
const SharedSliverAppBar({
Key? key,
required this.title,
}) : super(key: key);
final String title;
@override
Widget build(BuildContext context) {
return SliverAppBar(
backgroundColor: context.color.backgroundPrimary, // background color
foregroundColor: context.color.textPrimary, // text color
title: Text(' User $title Repositories'),
floating: true,
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/shared | mirrored_repositories/flutter_riverpod_template/lib/feature/shared/navigation/app_router.dart | import 'package:auto_route/auto_route.dart';
import 'app_router.gr.dart';
@AutoRouterConfig(replaceInRouteName: 'Page,Route')
class AppRouter extends $AppRouter {
@override
List<AutoRoute> get routes => [
// initial route mange login, logout etc in splash page decided navigation
AutoRoute(page: SplashRoute.page, initial: true),
// other pages routes
AutoRoute(page: HomeRoute.page),
AutoRoute(page: RepositoryListRoute.page),
AutoRoute(page: CounterRoute.page),
AutoRoute(page: NavigationRoute.page, children: [
AutoRoute(page: NavigationChild1Route.page),
AutoRoute(page: NavigationChild2Route.page),
]),
];
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/shared | mirrored_repositories/flutter_riverpod_template/lib/feature/shared/app_flavour/shared_main.dart | import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_riverpod_template/data/app_providers/app_provider.dart';
import 'package:flutter_riverpod_template/data/remote/api/cient/api_config.dart';
import 'package:flutter_riverpod_template/feature/shared/app_flavour/app_config.dart';
import 'package:flutter_riverpod_template/my_app.dart';
void sharedMain(AppConfig appConfig,
{List<Override> overrides = const []}) async {
await init(appConfig);
final List<Override> allOverrides = [
appProvider.overrideWithValue(
ApiConfig(appConfig.apiBaseUrl, apiKey: appConfig.appApiKey),
),
];
allOverrides.addAll(overrides);
runApp(
ProviderScope(
overrides: allOverrides,
child: MyApp(launchTitle: appConfig.launchTitle),
),
);
}
Future<void> init(AppConfig appConfig) {
debugPrint('sharedMain launch title ${appConfig.launchTitle}');
debugPrint('sharedMain environment ${appConfig.environment}');
debugPrint('sharedMain base url ${appConfig.apiBaseUrl}');
// TODO initialize others here
// eg. crashlitics
// orientation
// etc.
return Future.value();
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/shared | mirrored_repositories/flutter_riverpod_template/lib/feature/shared/app_flavour/app_config.dart | enum AppEnvironment {
dev,
prod,
}
class AppConfig {
AppConfig({
required this.launchTitle,
required this.environment,
required this.apiBaseUrl,
required this.appApiKey,
this.initializeCrashlytics = true,
});
final String launchTitle;
final AppEnvironment environment;
final String apiBaseUrl;
final String appApiKey;
final bool initializeCrashlytics;
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/shared/utils | mirrored_repositories/flutter_riverpod_template/lib/feature/shared/utils/styles/app_theme.dart | import 'package:flutter/material.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_color.dart';
class AppThemes {
static ThemeData appTheme(Brightness brightness) {
final colors = brightness == Brightness.light
? AppColor.lightColor
: AppColor.darkColor;
return ThemeData(
// root widget background color
// this is very nice to set default colors for all scaffold widget
scaffoldBackgroundColor: colors.backgroundPrimary,
// common divider color
dividerTheme: DividerThemeData(color: colors.divider, thickness: 0.5),
fontFamily: null, // set font here later
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/shared/utils | mirrored_repositories/flutter_riverpod_template/lib/feature/shared/utils/styles/app_color.dart | import 'package:flutter/material.dart';
// TODO manage readable names for colors
class AppColor {
const AppColor({
required this.textPrimary,
required this.divider,
required this.textSeconday,
required this.gray,
required this.backgroundPrimary,
required this.backgroundSecondary,
required this.red,
});
final Color textPrimary;
final Color divider;
final Color textSeconday;
final Color gray;
final Color backgroundPrimary;
final Color backgroundSecondary;
final Color red;
static const lightColor = AppColor(
textPrimary: Color(0xFF66D4CF),
divider: Color(0xFFf4f6f6),
textSeconday: Color(0xFFd9e2eb),
gray: Color(0xFFCAC7CC),
backgroundPrimary: Color(0xFFFFFFFF),
backgroundSecondary: Color(0xFFFFFFFF),
red: Color(0xFFFF0000),
);
static const darkColor = AppColor(
textPrimary: Color(0xFF66D4CF),
divider: Color(0xFFf4f6f6),
textSeconday: Color(0xFFd9e2eb),
gray: Color(0xFFCAC7CC),
backgroundPrimary: Color(0xFFFFFFFF),
backgroundSecondary: Color(0xFFFFFFFF),
red: Color(0xFFFF0000),
);
}
extension AppColorExtension on BuildContext {
// get color set by brightness
AppColor get color => _getColorByBrightness(Theme.of(this).brightness);
// decide colors
AppColor _getColorByBrightness(Brightness brightness) {
switch (brightness) {
case Brightness.light:
return AppColor.lightColor;
case Brightness.dark:
return AppColor.darkColor;
}
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/shared/utils | mirrored_repositories/flutter_riverpod_template/lib/feature/shared/utils/styles/app_text_style.dart | import 'package:flutter/material.dart';
class AppTextStyle {
const AppTextStyle._();
//body
static const TextStyle bodyLarge = TextStyle(
fontSize: 20.0,
);
static const TextStyle bodyLargeBold = TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
);
static const TextStyle bodyMedium = TextStyle(
fontSize: 18.0,
);
static const TextStyle bodyMediumBold = TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
);
static const TextStyle bodySmall = TextStyle(
fontSize: 16.0,
);
static const TextStyle bodySmallBold = TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
);
//title
static const TextStyle titleLarge = TextStyle(
fontSize: 16.0,
);
static const TextStyle titleLargeBold = TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
);
static const TextStyle titleMedium = TextStyle(
fontSize: 14.0,
);
static const TextStyle titleMediumBold = TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
);
static const TextStyle titleSmall = TextStyle(
fontSize: 12.0,
);
static const TextStyle titleSmallBold = TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.bold,
);
//bold
static const TextStyle labelLarge = TextStyle(
fontSize: 17.0,
);
static const TextStyle labelLargeBold = TextStyle(
fontSize: 17.0,
fontWeight: FontWeight.bold,
);
static const TextStyle labelMedium = TextStyle(
fontSize: 15.0,
);
static const TextStyle labelMediumBold = TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
);
static const TextStyle labelSmall = TextStyle(
fontSize: 13.0,
);
static const TextStyle labelSmallBold = TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
);
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/counter | mirrored_repositories/flutter_riverpod_template/lib/feature/counter/views/counter_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_color.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_text_style.dart';
import 'package:flutter_riverpod_template/feature/shared/widgets/shared_app_bar.dart';
@RoutePage()
class CounterPage extends HookWidget {
final String title;
const CounterPage({
required this.title,
Key? key,
}) : super(key: key);
@override
Widget build(
BuildContext context,
) {
final counterState = useState(0);
return Scaffold(
appBar: SharedAppBar(title: title),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
const Text(
'Push plus button to increase counter:',
),
Text(
'Value ${counterState.value}',
style: AppTextStyle.labelMedium
.copyWith(color: context.color.textPrimary),
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
counterState.value = counterState.value + 1;
},
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/navigation | mirrored_repositories/flutter_riverpod_template/lib/feature/navigation/views/navigation_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_riverpod_template/feature/navigation/views/navigation_tabs/navigation_tabs_view.dart';
import 'package:flutter_riverpod_template/feature/shared/navigation/app_router.gr.dart';
@RoutePage()
class NavigationPage extends HookWidget {
final String title;
const NavigationPage({
required this.title,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return AutoTabsScaffold(
routes: [
NavigationChild1Route(
title: "NavigationChild1Route",
),
NavigationChild2Route(
title: 'NavigationChild2Route',
),
],
bottomNavigationBuilder: (_, tabsRouter) {
return NavigationTabsView(tabsRouter);
},
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/navigation/views | mirrored_repositories/flutter_riverpod_template/lib/feature/navigation/views/navigation_tabs/navigation_tabs_view.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
class NavigationTabsView extends StatelessWidget {
final TabsRouter tabsRouter;
const NavigationTabsView(this.tabsRouter, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BottomNavigationBar(
currentIndex: tabsRouter.activeIndex,
onTap: (index) {
tabsRouter.setActiveIndex(index);
},
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.ac_unit_sharp),
label: 'Child1',
),
BottomNavigationBarItem(
icon: Icon(Icons.account_balance_sharp),
label: 'child2',
),
],
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/navigation/views | mirrored_repositories/flutter_riverpod_template/lib/feature/navigation/views/child_views/navigation_child2_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod_template/feature/shared/navigation/app_router.gr.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_color.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_text_style.dart';
import 'package:flutter_riverpod_template/feature/shared/widgets/shared_app_bar.dart';
@RoutePage()
class NavigationChild2Page extends StatelessWidget {
final String title;
const NavigationChild2Page({
required this.title,
Key? key,
}) : super(key: key);
@override
Widget build(
BuildContext context,
) {
return Scaffold(
appBar: SharedAppBar(title: title),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
const Text(
'Child 2',
),
Text(
'Value',
style: AppTextStyle.labelMedium
.copyWith(color: context.color.textPrimary),
),
// it is not recommented to jump to same navigation page better push to new screen without navigation
TextButton(
onPressed: () => context.router
.push(NavigationRoute(title: 'Navigation Example')),
child: const Text('Counter Example')),
],
),
),
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/navigation/views | mirrored_repositories/flutter_riverpod_template/lib/feature/navigation/views/child_views/navigation_child1_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_color.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_text_style.dart';
import 'package:flutter_riverpod_template/feature/shared/widgets/shared_app_bar.dart';
@RoutePage()
class NavigationChild1Page extends StatelessWidget {
final String title;
const NavigationChild1Page({
required this.title,
Key? key,
}) : super(key: key);
@override
Widget build(
BuildContext context,
) {
return Scaffold(
appBar: SharedAppBar(title: title),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
const Text(
'Child 1',
),
Text(
'Value',
style: AppTextStyle.labelMedium
.copyWith(color: context.color.textPrimary),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature | mirrored_repositories/flutter_riverpod_template/lib/feature/home/home_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_riverpod_template/feature/shared/navigation/app_router.gr.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_color.dart';
import 'package:flutter_riverpod_template/feature/shared/widgets/shared_app_bar.dart';
@RoutePage()
class HomePage extends ConsumerStatefulWidget {
const HomePage({
required this.title,
Key? key,
}) : super(key: key);
final String title;
@override
ConsumerState<HomePage> createState() => _HomePageState();
}
class _HomePageState extends ConsumerState<HomePage> {
@override
Widget build(
BuildContext context,
) {
return Scaffold(
appBar: SharedAppBar(
title: widget.title,
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
TextButton(
onPressed: () => context.router
.push(RepositoryListRoute(title: 'Repository ')),
child: const Text('Open Github User API Page')),
const Divider(),
TextButton(
onPressed: () => context.router
.push(CounterRoute(title: 'Counter Example')),
child: const Text('Counter Example')),
const Divider(),
TextButton(
onPressed: () => context.router
.push(NavigationRoute(title: 'Navigation Example')),
child: const Text('Navigation Example')),
],
),
),
bottomNavigationBar: Container(
height: 50,
color: context.color.textSeconday,
));
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature | mirrored_repositories/flutter_riverpod_template/lib/feature/splash/splash_page.dart | import 'dart:async';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod_template/feature/shared/navigation/app_router.gr.dart';
@RoutePage()
class SplashPage extends StatefulWidget {
const SplashPage({Key? key}) : super(key: key);
@override
State<SplashPage> createState() => _SplashPageState();
}
class _SplashPageState extends State<SplashPage> {
@override
void initState() {
super.initState();
// Navigate to the next screen after a delay
Timer(
const Duration(milliseconds: 500), // half second delay
() => context.router.replace(HomeRoute(title: 'Home page')),
);
}
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: Text('Splash Screen'),
),
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/repository_list | mirrored_repositories/flutter_riverpod_template/lib/feature/repository_list/views/repository_list_page.dart | import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_riverpod_template/feature/repository_list/models/repository_list_model.dart';
import 'package:flutter_riverpod_template/feature/repository_list/providers/repository_list_notifier_provider.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_color.dart';
import 'package:flutter_riverpod_template/feature/shared/utils/styles/app_text_style.dart';
import 'package:flutter_riverpod_template/feature/shared/widgets/shared_sliver_app_bar.dart';
@RoutePage()
class RepositoryListPage extends ConsumerStatefulWidget {
final String title;
const RepositoryListPage({
required this.title,
Key? key,
}) : super(key: key);
@override
ConsumerState<RepositoryListPage> createState() => _RepositoryListPageState();
}
class _RepositoryListPageState extends ConsumerState<RepositoryListPage> {
// read just once
RepositoryListNotifier get repositoryListNotifier =>
ref.read(repositoryListNotifierProvider.notifier);
@override
Widget build(BuildContext context) {
// keep watching, contininouse changes observation
final repositoryListAsync = ref.watch(repositoryListNotifierProvider);
return SafeArea(
child: Scaffold(
body: Container(
child: repositoryListAsync.when(
data: (data) => _buildListView(data),
error: (error, stackTrace) {
debugPrint(error.toString());
debugPrint(stackTrace.toString());
return Text('Error $error');
},
loading: () => const Center(child: Text('Loading...')),
),
),
),
);
}
Widget _buildListView(List<RepositoryListModel> modelList) {
return CustomScrollView(
slivers: <Widget>[
SharedSliverAppBar(
title: widget.title + repositoryListNotifier.userName,
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
final entry = modelList[index];
return _buildListRowView(entry);
},
childCount: modelList.length,
),
),
],
);
}
Widget _buildListRowView(RepositoryListModel model) {
return ListTile(
title: Text(
model.name,
style: AppTextStyle.labelLarge,
),
subtitle: Text(
model.description ?? '',
style:
AppTextStyle.bodySmall.copyWith(color: context.color.textPrimary),
),
);
}
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/repository_list | mirrored_repositories/flutter_riverpod_template/lib/feature/repository_list/models/repository_list_model.dart | import 'package:freezed_annotation/freezed_annotation.dart';
part 'repository_list_model.freezed.dart';
part 'repository_list_model.g.dart';
@freezed
class RepositoryListModel with _$RepositoryListModel {
factory RepositoryListModel({
@JsonKey(name: 'id') required int id,
@JsonKey(name: 'node_id') required String nodeId,
@JsonKey(name: 'name') required String name,
@JsonKey(name: 'full_name') required String fullName,
@JsonKey(name: 'private') required bool isPrivate,
@JsonKey(name: 'owner') required Owner owner,
@JsonKey(name: 'html_url') required String htmlUrl,
@JsonKey(name: 'description') required String? description,
@JsonKey(name: 'fork') required bool isFork,
@JsonKey(name: 'url') required String? url,
// Add other fields as needed
}) = _RepositoryListModel;
factory RepositoryListModel.fromJson(Map<String, dynamic> json) =>
_$RepositoryListModelFromJson(json);
}
@freezed
class Owner with _$Owner {
factory Owner({
@JsonKey(name: 'login') required String login,
@JsonKey(name: 'id') required int id,
@JsonKey(name: 'node_id') required String nodeId,
@JsonKey(name: 'avatar_url') required String avatarUrl,
@JsonKey(name: 'html_url') required String htmlUrl,
@JsonKey(name: 'followers_url') required String followersUrl,
@JsonKey(name: 'following_url') required String followingUrl,
@JsonKey(name: 'gists_url') required String gistsUrl,
@JsonKey(name: 'starred_url') required String starredUrl,
@JsonKey(name: 'subscriptions_url') required String subscriptionsUrl,
@JsonKey(name: 'organizations_url') required String organizationsUrl,
@JsonKey(name: 'repos_url') required String reposUrl,
@JsonKey(name: 'events_url') required String eventsUrl,
@JsonKey(name: 'received_events_url') required String receivedEventsUrl,
@JsonKey(name: 'type') required String type,
@JsonKey(name: 'site_admin') required bool isSiteAdmin,
}) = _Owner;
factory Owner.fromJson(Map<String, dynamic> json) => _$OwnerFromJson(json);
}
| 0 |
mirrored_repositories/flutter_riverpod_template/lib/feature/repository_list | mirrored_repositories/flutter_riverpod_template/lib/feature/repository_list/providers/repository_list_notifier_provider.dart | import 'package:flutter_riverpod_template/data/remote/api/providers/user/user_repository_provider.dart';
import 'package:flutter_riverpod_template/feature/repository_list/models/repository_list_model.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'repository_list_notifier_provider.g.dart';
@riverpod
class RepositoryListNotifier extends _$RepositoryListNotifier {
final userName = 'dinkar1708';
final pageSize = 5;
@override
Future<List<RepositoryListModel>> build() async => await ref
.read(userRepositoryProvider)
.getRepositories(userName, pageSize);
}
| 0 |
mirrored_repositories/flutter_riverpod_template | mirrored_repositories/flutter_riverpod_template/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_riverpod_template/my_app.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp(
launchTitle: "Test",
));
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/legal_companion | mirrored_repositories/legal_companion/lib/org_images.dart | class OrgImages {
static const String imagesPath = 'assets/images/';
static const String akuafo = 'akuafo.jpg';
static const String commonwealth = 'commonwealth.jpg';
static const String compsa = 'compsa.png';
static const String ghana = 'ug.svg';
static const String ghl = 'ghl.png';
static const String jubilee = 'jubilee.jpg';
static const String law = 'law.jpg';
static const String legonhall = 'legonhall.jpg';
static const String nupsg = 'nupsg.jpg';
static const String sarbah = 'sarbah.jpg';
static const String sey = 'sey.jpg';
static const String src = 'src.jpg';
static const String volta = 'volta.jpg';
} | 0 |
mirrored_repositories/legal_companion | mirrored_repositories/legal_companion/lib/constants.dart | import 'package:flutter/material.dart';
const kBackgroundColor = Color(0xFFF8F8F8);
const kMainColor = Color(0xFF0B3C5D);
const kTextColor = Color(0xFFFFFFFF);
const kBlueLightColor = Color(0xFF328CC1);
const kGoldColor = Color(0xFFFFF700);
const kShadowColor = Color(0xFFCDCDCD);
//Onboarding colors
const onboard1Color = Color(0xFF58CCED);
const onboard2Color = Color(0xFF1261A0);
const onboard3Color = Color(0xFF0B3C5D);
//Onboarding titles
const String onboard1Title = "Power of Knowlegde";
const String onboard2Title = "Companion";
const String onboard3Title = "Know Your Constitutions";
//Onboarding description
const String onboard1Desc = "Pocesses the power of truth by acquiring knowledge.";
const String onboard2Desc = "A Good Companion Shortens the Longest Roads.";
const String onboard3Desc = "Get all required legistive instruments you require on your mobile.";
| 0 |
mirrored_repositories/legal_companion | mirrored_repositories/legal_companion/lib/main.dart | // ignore_for_file: prefer_const_constructors
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:legal_companion/controller/constitution_controller.dart';
import 'package:legal_companion/screens/onboard.dart';
import 'package:legal_companion/screens/splash.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
MyApp({super.key});
final Future<FirebaseApp> _initialization = Firebase.initializeApp();
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
Get.lazyPut(() => ConstitutionController());
return GetMaterialApp(
debugShowCheckedModeBanner: false,
home: FutureBuilder(
future: _initialization,
builder: (context, snapshot) {
if (snapshot.hasError) {
//print("Error");
}
if (snapshot.connectionState == ConnectionState.done) {
return Splash();
}
return Center(child: CircularProgressIndicator());
}),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/widgets/searchbar.dart | import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:legal_companion/controller/constitution_controller.dart';
import 'package:legal_companion/services/service.dart';
import '../model/constitution_model.dart';
class SearchBar extends StatefulWidget {
const SearchBar({super.key});
@override
State<SearchBar> createState() => _SearchBarState();
}
class _SearchBarState extends State<SearchBar> {
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 30),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
child: const CupertinoSearchTextField(
// onSubmitted: (search) async {
// var response = await HttpService.getConstitutions(search);
// if (response.statusCode == 200) {
// List<dynamic> body = json.decode(response.body);
// List<Constitution> constitutions = body
// .map(
// (dynamic item) => Constitution.fromJson(item),
// )
// .toList();
// var search = constitutionController.constitutionList[index];
// setState(() {
// search =
// print("object");
// });
// }
// },
autofocus: true,
itemColor: Colors.black,
itemSize: 20,
backgroundColor: Color.fromARGB(255, 185, 204, 218),
placeholderStyle: TextStyle(
color: Colors.black,
fontSize: 18,
),
),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/widgets/drawer_widget.dart | import 'package:flutter/material.dart';
import '../model/drawer_model.dart';
class DrawerWidget extends StatelessWidget {
const DrawerWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Drawer(
child: Material(
color: Colors.white70,
child: Padding(
padding: const EdgeInsets.fromLTRB(24.0, 80, 24, 0),
child: SingleChildScrollView(
child: Column(
children: [
profileWidget(),
const SizedBox(
height: 35,
),
const Divider(
thickness: 1,
height: 10,
color: Colors.black,
),
const SizedBox(
height: 40,
),
DrawerModel(
name: 'Profie',
icon: Icons.account_box_rounded,
onPressed: () {},
),
const SizedBox(
height: 20,
),
DrawerModel(
name: 'Requests',
icon: Icons.send_outlined,
onPressed: () {},
),
const SizedBox(
height: 20,
),
DrawerModel(
name: 'Organization',
icon: Icons.people,
onPressed: () {},
),
const SizedBox(
height: 20,
),
DrawerModel(
name: 'feedbacks',
icon: Icons.message_outlined,
onPressed: () {},
),
const SizedBox(
height: 20,
),
const Divider(
thickness: 1,
height: 5,
color: Colors.black,
),
const SizedBox(
height: 20,
),
DrawerModel(
name: 'Setting',
icon: Icons.settings,
onPressed: () {},
),
const SizedBox(
height: 20,
),
DrawerModel(
name: 'Log out',
icon: Icons.logout,
onPressed: () {},
),
],
),
),
),
),
);
}
Widget profileWidget() {
return Row(
children: [
const CircleAvatar(
radius: 40,
backgroundImage: AssetImage("assets/images/dp.jpg"),
),
const SizedBox(
width: 20,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text('User Name',
style: TextStyle(fontSize: 14, color: Color(0xFF0B3C5D))),
SizedBox(
height: 10,
),
Text('[email protected]',
style: TextStyle(fontSize: 14, color: Color(0xFF0B3C5D)))
],
)
],
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/widgets/shimmer_listcard.dart | import 'package:flutter/material.dart';
class ShimmerForArticle extends StatelessWidget {
const ShimmerForArticle({super.key});
@override
Widget build(BuildContext context) {
// final double height = MediaQuery.of(context).size.height;
// final double width = MediaQuery.of(context).size.width;
return Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
height: 63,
child: Card(
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 18,
width: MediaQuery.of(context).size.width - 48,
child: Container(
decoration: const BoxDecoration(
shape: BoxShape.rectangle, color: Colors.white),
)
),
const SizedBox(
height: 2,
),
Container(
decoration: const BoxDecoration(
shape: BoxShape.rectangle, color: Colors.white),
)
],
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/widgets/shimmer_grid_card.dart | import 'package:flutter/material.dart';
class ShimmerGridCard extends StatelessWidget {
const ShimmerGridCard({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 100,
width: double.infinity,
child: Container(
decoration: const BoxDecoration(
shape: BoxShape.rectangle, color: Colors.white),
)
),
const Spacer(),
Container(
height: 30,
width: 100,
decoration: const BoxDecoration(
shape: BoxShape.rectangle, color: Colors.white),
)
],
),
);
}
} | 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/widgets/constitution_card.dart | // ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
import '../model/constitution_model.dart';
class ConstitutionCard extends StatelessWidget {
final Constitution constitution;
const ConstitutionCard(this.constitution, {super.key});
@override
Widget build(BuildContext context) {
return Card(
color: Colors.blueAccent[80],
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Spacer(),
SizedBox(
height: 85,
width: double.infinity,
child: SvgPicture.asset("assets/images/ug.svg"),
),
const Spacer(),
Text(
constitution.title,
textAlign: TextAlign.center,
style: GoogleFonts.openSans(
textStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
),
),
),
Spacer()
],
),
),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/widgets/listcard.dart | // ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class ListCard extends StatelessWidget {
final String desc;
final String name;
final VoidCallback action;
const ListCard({super.key,
required this.desc,
required this.name,
required this.action,
});
@override
Widget build(BuildContext context) {
final double height = MediaQuery.of(context).size.height;
final double width = MediaQuery.of(context).size.width;
return SizedBox(
height: height * 0.09,
width: width * 0.07,
child: InkWell(
onTap: action,
child: Card(
child: Row(
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
color: Colors.grey[200],
height: 18,
width: MediaQuery.of(context).size.width - 48,
child: Text(desc,
style: TextStyle(
fontWeight: FontWeight.w300,
),),
),
const SizedBox(height: 3,),
Expanded(
child: Text(name,
overflow: TextOverflow.visible,
style: GoogleFonts.openSans(
textStyle: const TextStyle(
fontSize: 17,
fontWeight: FontWeight.w500,
color: Colors.black,
),
),
),
),
],
),
),
],
),
),
),
);
}
} | 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/onBoardScreens/onboard3.dart | // ignore_for_file: prefer_const_constructors
import 'package:delayed_display/delayed_display.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
import '../constants.dart';
class Onboard3 extends StatelessWidget {
const Onboard3({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Container(
padding: const EdgeInsets.all(30.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
SvgPicture.asset(
"assets/images/legal.svg",
height: size.height * 0.42,
),
Text(
onboard3Title,
textAlign: TextAlign.center,
style: GoogleFonts.openSans(
textStyle: TextStyle(
fontSize: 26.0,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
DelayedDisplay(
fadingDuration: Duration(seconds: 1),
child: Text(onboard3Desc,
textAlign: TextAlign.center,
style: GoogleFonts.openSans(
textStyle: TextStyle(
fontSize: 20.0,
color: Colors.black54,
),
)),
),
],
),
const SizedBox(
height: 60.0,
),
],
),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/onBoardScreens/onboard1.dart | // ignore_for_file: prefer_const_constructors
import 'package:delayed_display/delayed_display.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
import '../constants.dart';
class Onboard1 extends StatelessWidget {
const Onboard1({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Container(
padding: const EdgeInsets.all(30.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
SvgPicture.asset(
"assets/images/knowledge.svg",
height: size.height * 0.46,
),
Text(
onboard1Title,
textAlign: TextAlign.center,
style: GoogleFonts.openSans(
textStyle: TextStyle(
fontSize: 26.0,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
DelayedDisplay(
fadingDuration: Duration(seconds: 1),
child: Text(onboard1Desc,
textAlign: TextAlign.center,
style: GoogleFonts.openSans(
textStyle: TextStyle(
fontSize: 20.0,
color: Colors.black54,
),
)),
),
],
),
const SizedBox(
height: 60.0,
),
],
),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/onBoardScreens/onboard2.dart | // ignore_for_file: prefer_const_constructors
import 'package:delayed_display/delayed_display.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
import '../constants.dart';
class Onboard2 extends StatelessWidget {
const Onboard2({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Container(
padding: const EdgeInsets.all(30.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
SvgPicture.asset(
"assets/images/companion.svg",
height: size.height * 0.46,
),
Text(
onboard2Title,
textAlign: TextAlign.center,
style: GoogleFonts.openSans(
textStyle: TextStyle(
fontSize: 26.0,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
DelayedDisplay(
fadingDuration: Duration(seconds: 1),
child: Text(onboard2Desc,
textAlign: TextAlign.center,
style: GoogleFonts.openSans(
textStyle: TextStyle(
fontSize: 20.0,
color: Colors.black54,
),
)),
),
],
),
const SizedBox(
height: 60.0,
),
],
),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/model/constitution_model.dart |
class Constitution {
final String id;
final String title;
final String preamble;
final String createdAt;
final String updatedAt;
Constitution({
required this.id,
required this.title,
required this.preamble,
required this.createdAt,
required this.updatedAt,
});
factory Constitution.fromJson(Map<String, dynamic> json) {
return Constitution(
id: json['_id'] as String,
title: json['title'] as String,
preamble: json['preamble'] as String,
createdAt: json['createdAt'] as String,
updatedAt: json['updatedAt'] as String,
);
}
}
class Chapter {
final String id;
final String constitution;
final String title;
final String description;
final String createdAt;
final String updatedAt;
Chapter({
required this.id,
required this.constitution,
required this.title,
required this.description,
required this.createdAt,
required this.updatedAt,
});
factory Chapter.fromJson(Map<String, dynamic> json) {
return Chapter(
id: json['_id'] as String,
constitution: json['constitution'],
title: json['title'] as String,
description: json['description'] as String,
createdAt: json['createdAt'] as String,
updatedAt: json['updatedAt'] as String,
);
}
}
class Section {
final String id;
final String constitution;
final String chapter;
final String title;
final String content;
Section({
required this.id,
required this.constitution,
required this.chapter,
required this.title,
required this.content,
});
factory Section.fromJson(Map<String, dynamic> json) {
return Section(
id: json['_id'] as String,
constitution: json['constitution'] as String,
chapter: json['chapter'] as String,
title: json['title'] as String,
content: json['content'] as String,
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/model/drawer_model.dart | // ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
class DrawerModel extends StatelessWidget {
const DrawerModel(
{Key? key,
required this.name,
required this.icon,
required this.onPressed})
: super(key: key);
final String name;
final IconData icon;
final Function() onPressed;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onPressed,
child: SizedBox(
height: 40,
child: Row(
children: [
Icon(
icon,
size: 20,
color: Color(0xFF0B3C5D),
),
const SizedBox(
width: 40,
),
Text(
name,
style: const TextStyle(fontSize: 20, color: Color(0xFF0B3C5D)),
)
],
),
),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/controller/constitution_controller.dart | import 'dart:convert';
import 'package:get/state_manager.dart';
import '../model/constitution_model.dart';
import '../services/service.dart';
class ConstitutionController extends GetxController {
var isLoading = false.obs;
RxList constitutionList = <Constitution>[].obs;
RxList chapterList = <Chapter>[].obs;
RxList sectionList = <Section>[].obs;
//Causes the objects to appear on debugging
@override
void onInit() {
getConstitutions("");
super.onInit();
}
void getConstitutions(String search) async {
try {
isLoading(true);
dynamic response = await HttpService.getConstitutions(search);
if (response.statusCode == 200) {
List<dynamic> body = jsonDecode(response.body);
List<Constitution> constitutions = body
.map(
(dynamic item) => Constitution.fromJson(item),
)
.toList();
constitutionList(constitutions);
isLoading(false);
}
} catch (err) {
isLoading(false);
} finally {
isLoading(false);
}
}
Future getChapters(String constitutionId) async {
try {
isLoading(true);
dynamic response = await HttpService.getChapters(constitutionId);
if (response.statusCode == 200) {
List<dynamic> body = jsonDecode(response.body);
List<Chapter> chapters = body
.map(
(dynamic item) => Chapter.fromJson(item),
)
.toList();
chapterList(chapters);
isLoading(false);
}
} catch (err) {
// print(err);
isLoading(false);
} finally {
isLoading(false);
}
}
Future getSections(String constitutionId, String chapterId) async {
try {
isLoading(true);
dynamic response =
await HttpService.getSections(constitutionId, chapterId);
if (response.statusCode == 200) {
List<dynamic> body = jsonDecode(response.body);
List<Section> sections = body
.map(
(dynamic item) => Section.fromJson(item),
)
.toList();
sectionList(sections);
// print(sectionList);
isLoading(false);
}
} catch (err) {
// print("errorr hhhherrrrrrrhhhh");
// print(err);
isLoading(false);
}
finally {
isLoading(false);
}
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/services/service.dart | import 'package:http/http.dart';
import 'package:string_templates/string_templates.dart' as templates;
class HttpService {
static String constitutionsUrl =
"https://legal-companion-backend.onrender.com/api/v2/constitutions/";
static String chaptersUrl =
"https://legal-companion-backend.onrender.com/api/v2/constitutions/{constitutionId}/chapters";
static String sectionsUrl =
"https://legal-companion-backend.onrender.com/api/v2/constitutions/{constitutionId}/chapters/{chapterId}/sections";
static Future getConstitutions(String search) async {
var params = <String, Object>{'search': search};
return await get(Uri.parse(templates.interpolate(constitutionsUrl, params)));
}
static Future getChapters(
String constitutionId) async {
var params = <String, Object>{
'constitutionId': constitutionId,
};
return await get(Uri.parse(templates.interpolate(chaptersUrl, params)));
}
static Future getSections(
String constitutionId, String chapterId) async {
var params = <String, Object>{
'constitutionId': constitutionId,
'chapterId': chapterId
};
return await get(Uri.parse(templates.interpolate(sectionsUrl, params)));
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/screens/article_page.dart | // ignore_for_file: must_be_immutable, prefer_const_constructors, use_key_in_widget_constructors, prefer_const_constructors_in_immutables
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../controller/constitution_controller.dart';
import '../model/constitution_model.dart';
class ArticlePage extends StatefulWidget {
final Chapter chapter;
ArticlePage({ required this.chapter});
@override
State<ArticlePage> createState() => _ArticlePageState();
}
class _ArticlePageState extends State<ArticlePage> {
final ConstitutionController constitutionController = Get.find();
@override
Widget build(BuildContext context) {
final double height = MediaQuery.of(context).size.height;
final double width = MediaQuery.of(context).size.width;
return Scaffold(
appBar: AppBar(
backgroundColor: const Color(0xFF0B3C5D),
elevation: 0,
leading: IconButton(
onPressed: () {
Get.back();
},
icon: const Icon(
Icons.arrow_back_ios_new_outlined,
size: 20,
color: Colors.white,
),
),
actions: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.search,
size: 22,
color: Colors.white,
),
),
],
),
body: Stack(
children: [
Container(
height: height * 0.12,
color: const Color(0xFF0B3C5D),
),
Column(
children: [
SizedBox(
height: height * 0.10,
child: Center(
child: Text(
widget.chapter.description,
style: const TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
Expanded(
child: Obx(() {
return constitutionController.isLoading.value
? Center(child: CircularProgressIndicator(color: Color(0xFF0B3C5D),))
: ListView.builder(
itemCount: constitutionController.sectionList.length,
itemBuilder: (context, index) {
Section section = constitutionController.sectionList[index];
return SizedBox(
height: height * 0.23,
child: Card(
child: Row(
children: [
Column(
children: [
Container(
color: Colors.grey[200],
width: MediaQuery.of(context).size.width - 8,
height: 30,
child: Center(
child: Text(
section.title,
style: const TextStyle(
fontSize: 16,
color: Colors.black,
fontWeight: FontWeight.w600,
),
),
),
),
SizedBox(height: height * 0.009,),
Expanded(
child: SizedBox(
width: width * 0.925,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Text(
section.content,
style: TextStyle(
fontSize: 17, color: Colors.grey[800]
),
),
),
),
),
],
),
],
),
),
);
});
}
),
),
],
),
]
),
);
}
} | 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/screens/home_page.dart | // ignore_for_file: prefer_const_constructors
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:legal_companion/screens/constitution_page.dart';
import 'package:legal_companion/widgets/searchbar.dart';
import 'package:shimmer/shimmer.dart';
import '../controller/constitution_controller.dart';
import '../model/constitution_model.dart';
import '../widgets/constitution_card.dart';
import '../widgets/drawer_widget.dart';
import '../widgets/shimmer_grid_card.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final ConstitutionController constitutionController = Get.find();
@override
Widget build(BuildContext context) {
final double height = MediaQuery.of(context).size.height;
return Scaffold(
appBar: AppBar(
backgroundColor: const Color(0xFF0B3C5D),
elevation: 0.0,
),
drawer: DrawerWidget(),
body: Stack(children: [
Container(
height: height * 0.45,
decoration: const BoxDecoration(
color: Color(0xFF0B3C5D),
// image: DecorationImage(
// image: ExactAssetImage('images/hpb.png'))
),
),
SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: [
Text(
'Legal Companion',
style: GoogleFonts.firaSans(
textStyle: const TextStyle(
color: Colors.white,
fontSize: 32,
),
),
),
// The Search bar
SearchBar(),
const SizedBox(
height: 45,
),
Flexible(
child: Obx(() {
if (constitutionController.isLoading.value) {
return GridView.builder(
itemBuilder: (_, __) {
return Shimmer.fromColors(
baseColor: Colors.grey[300]!,
highlightColor: Colors.grey[100]!,
period: Duration(seconds: 2),
enabled: constitutionController.isLoading.value,
child: ShimmerGridCard());
},
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2),
);
} else {
return GridView.builder(
itemCount:
constitutionController.constitutionList.length,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2),
itemBuilder: (context, index) {
Constitution constitution =
constitutionController.constitutionList[index];
return InkWell(
onTap: (() {
Get.to(
BranchPage(constitutionId: constitution));
}),
child: ConstitutionCard(constitutionController
.constitutionList[index]));
});
}
}),
),
],
),
),
),
]),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/screens/Splash.dart | // ignore_for_file: file_names
import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:flutter/material.dart';
import 'package:legal_companion/screens/onboard.dart';
import 'package:lottie/lottie.dart';
class Splash extends StatelessWidget {
const Splash({ Key? key }) : super(key: key);
@override
Widget build(BuildContext context) {
return AnimatedSplashScreen(
splash:
Lottie.asset('assets/splash.json'),
backgroundColor: const Color(0xFF0B3C5D),
nextScreen: const OnBoard(),
duration: 3000,
splashIconSize: 380,
);
}
} | 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/screens/constitution_page.dart | // ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:legal_companion/screens/chapter_page.dart';
import '../controller/constitution_controller.dart';
import '../model/constitution_model.dart';
import '../widgets/listcard.dart';
class BranchPage extends StatelessWidget {
final Constitution constitutionId;
BranchPage({super.key, required this.constitutionId});
final ConstitutionController constitutionController = Get.find();
@override
Widget build(BuildContext context) {
final double height = MediaQuery.of(context).size.height;
// final double width = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: Colors.grey[200]!,
appBar: AppBar(
backgroundColor: const Color(0xFF0B3C5D),
elevation: 0,
leading: IconButton(
onPressed: () {
Get.back();
},
icon: const Icon(
Icons.arrow_back_ios_new_outlined,
color: Colors.white,
size: 20,
)),
),
body: Stack(children: [
Container(
height: height * 0.35,
color: const Color(0xFF0B3C5D),
),
SafeArea(
child: constitutionController.isLoading.isTrue
? Center(
child: CircularProgressIndicator(
color: Color(0xFF0B3C5D),
))
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
SizedBox(
height: 120,
width: 100,
child: SvgPicture.asset("assets/images/ug.svg"),
),
const SizedBox(height: 50),
Text(
textAlign: TextAlign.center,
constitutionId.title,
style: GoogleFonts.roboto(
textStyle: const TextStyle(
fontSize: 25,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
),
Flexible(
child: Ink(
child: ListView(
padding: const EdgeInsets.all(10),
children: [
SizedBox(height: 25,),
ListCard(
desc:
'Tap on this display the constitution preamble',
name: 'Preamble',
action: () {
Get.defaultDialog(
title: "ABOUT CONSTITUTION",
content: Flexible(
child: SingleChildScrollView(
child: Text(constitutionId.preamble,
style: GoogleFonts.openSans(
textStyle: TextStyle(
color: Colors.black87,
fontSize: 18),
)),
),
),
backgroundColor: Colors.white,
titleStyle: const TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.w700
),
radius: 8.0,
);
},
),
ListCard(
desc:
'Display the constitution chapters next page',
name: 'Chapters',
action: () async {
await constitutionController
.getChapters(constitutionId.id)
.then((value) {
Get.to(ChapterPage());
});
},
),
ListCard(
desc:
'Tap to view added amendements of the constitution',
name: 'The Amendments',
action: () async {
await constitutionController
.getChapters(constitutionId.id)
.then((value) {
Get.to(ChapterPage());
});
},
),
],
),
),
),
],
),
),
),
]),
floatingActionButton: SizedBox(
height: 65,
width: 65,
child: FittedBox(
child: FloatingActionButton(
onPressed: () {},
backgroundColor: const Color(0xFF0B3C5D),
child: const Icon(Icons.share_rounded, size: 30,),
),
),
),
);
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/screens/onboard.dart | // ignore_for_file: prefer_const_constructors, prefer_final_fields, prefer_const_literals_to_create_immutables
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:legal_companion/screens/home_page.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
import '../constants.dart';
import '../onBoardScreens/onboard1.dart';
import '../onBoardScreens/onboard2.dart';
import '../onBoardScreens/onboard3.dart';
class OnBoard extends StatefulWidget {
const OnBoard({Key? key}) : super(key: key);
@override
State<OnBoard> createState() => _OnBoardState();
}
class _OnBoardState extends State<OnBoard> {
// Pages
PageController _controller = PageController();
// On last page function
bool onLastPage = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
alignment: Alignment.center,
children: [
//Page View
PageView(
controller: _controller,
onPageChanged: (index) {
setState(() {
onLastPage = (index == 2);
});
},
children: [Onboard1(), Onboard2(), Onboard3()],
),
//Skip
onLastPage ?
Positioned(
top: 25,
right: 20,
child: TextButton(
onPressed: () {
_controller.jumpToPage(2);
},
child: Text(" ",
style: GoogleFonts.openSans(
textStyle: TextStyle(
fontSize: 20.0,
color: kMainColor,
fontWeight: FontWeight.bold,
),
),),
),
) : Positioned(
top: 25,
right: 20,
child: TextButton(
onPressed: () {
_controller.jumpToPage(2);
},
child: Text("Skip",
style: GoogleFonts.openSans(
textStyle: TextStyle(
fontSize: 20.0,
color: kMainColor,
fontWeight: FontWeight.bold,
),
),),
),
),
// buttons
onLastPage
? Positioned(
bottom: 60,
child: GestureDetector(
child: OutlinedButton(
onPressed: () {
Get.to(() => HomePage());
},
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
side: BorderSide(color: kMainColor),
shape: CircleBorder(),
padding: EdgeInsets.all(20)),
child: Container(
padding: EdgeInsets.all(20.0),
decoration: BoxDecoration(
color: kMainColor, shape: BoxShape.circle),
child: Text('Start'),
),
),
),
)
: Positioned(
bottom: 60,
child: OutlinedButton(
onPressed: () {
_controller.nextPage(
duration: Duration(milliseconds: 400),
curve: Curves.easeIn);
},
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
side: BorderSide(color: kMainColor),
shape: CircleBorder(),
padding: EdgeInsets.all(20)),
child: Container(
padding: EdgeInsets.all(20.0),
decoration: BoxDecoration(
color: kMainColor, shape: BoxShape.circle),
child: Icon(Icons.arrow_forward_ios),
),
),
),
// Indicator
Positioned(
bottom: 10,
child: SmoothPageIndicator(
controller: _controller,
count: 3,
effect: WormEffect(
activeDotColor: kMainColor,
dotHeight: 4.0,
),
),
),
],
));
}
}
| 0 |
mirrored_repositories/legal_companion/lib | mirrored_repositories/legal_companion/lib/screens/chapter_page.dart | // ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables, avoid_unnecessary_containers
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:legal_companion/screens/article_page.dart';
import '../controller/constitution_controller.dart';
import '../model/constitution_model.dart';
import '../widgets/listcard.dart';
class ChapterPage extends StatelessWidget {
// final Constitution constitutionId;
ChapterPage({super.key});
final ConstitutionController constitutionController = Get.find();
@override
Widget build(BuildContext context) {
final double height = MediaQuery.of(context).size.height;
final double width = MediaQuery.of(context).size.width;
return Scaffold(
body: Stack(
children: [
Container(
height: height * 0.25,
width: width,
color: Color(0xFF0B3C5D),
child: Align(
alignment: Alignment.topLeft,
child: IconButton(
onPressed: () {
Get.back();
},
icon: Icon(
Icons.arrow_back_ios_new_outlined,
size: 20,
color: Colors.white,
),
),
),
),
Column(
children: [
SizedBox(
height: height * 0.20,
child: Center(
child: Text(
"Chapters",
style: GoogleFonts.firaSans(
textStyle: TextStyle(
color: Colors.white,
fontSize: 31,
fontWeight: FontWeight.bold,
),
),
),
),
),
SizedBox(height: 15,),
Flexible(
child: Obx(() {
return constitutionController.isLoading.isTrue
? Center(
child: Center(
child: CircularProgressIndicator(
color: Colors.black,
),
))
: ListView.builder(
itemCount: constitutionController.chapterList.length,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
Chapter chapter =
constitutionController.chapterList[index];
return ListCard(
action: () async {
await constitutionController
.getSections(chapter.constitution, chapter.id)
.then((response) {
Get.to(() => ArticlePage(chapter: chapter));
});
},
desc: chapter.title,
name: chapter.description,
);
},
padding: EdgeInsets.all(10),
);
}),
),
],
),
],
),
);
}
}
| 0 |
mirrored_repositories/legal_companion | mirrored_repositories/legal_companion/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:legal_companion/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/Flutter-UI-Challenge-Fashion-App | mirrored_repositories/Flutter-UI-Challenge-Fashion-App/lib/main.dart | import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: ProductScreen(),
);
}
}
class ProductScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
WidgetPageViewHeader(),
Align(
alignment: Alignment.bottomCenter,
child: WidgetDescription(),
),
SafeArea(
minimum: EdgeInsets.only(
left: 16.0,
right: 16.0,
),
child: Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Icon(
Platform.isIOS ? Icons.arrow_back_ios : Icons.arrow_back,
color: Colors.white,
),
SizedBox(
width: 24.0,
height: 24.0,
child: Stack(
children: <Widget>[
Icon(
Icons.shopping_basket,
color: Colors.white,
),
Align(
alignment: Alignment.topRight,
child: Container(
width: 8.0,
height: 8.0,
decoration: BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
),
],
),
)
],
),
),
)
],
),
);
}
}
class WidgetPageViewHeader extends StatefulWidget {
@override
_WidgetPageViewHeaderState createState() => _WidgetPageViewHeaderState();
}
class _WidgetPageViewHeaderState extends State<WidgetPageViewHeader> {
final listImageHeader = [
'assets/images/header_1.jpg',
'assets/images/header_2.jpg',
'assets/images/header_3.jpg',
'assets/images/header_4.jpg',
];
int _indexHeader = 0;
@override
Widget build(BuildContext context) {
var mediaQuery = MediaQuery.of(context);
var heightImage = mediaQuery.size.height / 1.5;
return Container(
height: heightImage,
child: Stack(
children: <Widget>[
PageView.builder(
itemBuilder: (context, index) {
return Image.asset(
listImageHeader[index],
fit: BoxFit.cover,
);
},
itemCount: listImageHeader.length,
onPageChanged: (index) {
setState(() {
_indexHeader = index;
});
},
),
Padding(
padding: EdgeInsets.only(
top: mediaQuery.size.height / 1.9,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
for (int i = 0; i < listImageHeader.length; i++)
if (i == _indexHeader) circleBar(true) else circleBar(false),
],
),
),
],
),
);
}
Widget circleBar(bool isActive) {
return AnimatedContainer(
duration: Duration(milliseconds: 250),
margin: EdgeInsets.symmetric(horizontal: 8.0),
height: isActive ? 16 : 12,
width: isActive ? 16 : 12,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
border: isActive ? Border.all(color: Colors.white) : null,
),
padding: EdgeInsets.all(isActive ? 4.0 : 0.0),
child: Container(
width: isActive ? 8 : 16,
height: isActive ? 8 : 16,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
color: Colors.white,
),
),
);
}
}
class WidgetDescription extends StatelessWidget {
@override
Widget build(BuildContext context) {
var mediaQuery = MediaQuery.of(context);
return Container(
height: mediaQuery.size.height / 2.3,
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xFFE0E0E0),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(48.0),
topRight: Radius.circular(48.0),
),
),
child: Stack(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 24.0, top: 40.0, right: 24.0),
child: LayoutBuilder(
builder: (context, constraints) {
return ListView(
padding: EdgeInsets.only(
bottom: mediaQuery.size.height -
mediaQuery.size.height / 1.1 +
16.0),
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_buildWidgetProductName(context),
_buildWidgetProductPrice(context),
Padding(
padding:
const EdgeInsets.only(top: 16.0, bottom: 16.0),
child: Divider(
height: 2.0,
color: Colors.black,
),
),
WidgetChooseColor(),
SizedBox(height: 16.0),
WidgetChooseSize(),
_buildWidgetProductInfo(context),
],
),
],
);
},
),
),
Align(
alignment: Alignment.bottomCenter,
child: WidgetAddToBag(),
),
],
),
);
}
Widget _buildWidgetProductPrice(BuildContext context) {
return Text(
'Rp 159.000',
style: Theme.of(context).textTheme.body1.merge(TextStyle(fontSize: 16.0)),
);
}
Widget _buildWidgetProductName(BuildContext context) {
return Wrap(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
'Y&F Samhita Plain Bodycon\nMini Dress',
style: Theme.of(context).textTheme.title,
),
),
Wrap(
direction: Axis.vertical,
children: <Widget>[
Icon(Icons.share),
SizedBox(height: 16.0),
Icon(Icons.favorite_border),
],
),
],
),
],
);
}
Widget _buildWidgetProductInfo(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 20.0),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: 'This is a beautiful women Mini Dress for your daily look, '
'it is elegance meets... ',
style: Theme.of(context)
.textTheme
.body1
.merge(TextStyle(fontSize: 16.0)),
),
TextSpan(
text: 'More',
style: Theme.of(context).textTheme.body1.merge(
TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
),
))
],
),
),
);
}
}
class WidgetChooseColor extends StatefulWidget {
final List<String> colorsName = [
'Navy',
'Milo',
'Maroon',
'Grey',
];
final List<Color> colors = [
Color(0xFF221D33),
Color(0xFFD7BA97),
Color(0xFF9C606C),
Color(0xFFA8BCBD),
];
@override
_WidgetChooseColorState createState() => _WidgetChooseColorState();
}
class _WidgetChooseColorState extends State<WidgetChooseColor> {
int _indexSelected;
@override
void initState() {
_indexSelected = widget.colors.length - 1;
super.initState();
}
@override
Widget build(BuildContext context) {
return Row(
children: <Widget>[
RichText(
text: TextSpan(
children: [
TextSpan(
text: 'Color: ',
style: TextStyle(color: Colors.black87),
),
TextSpan(
text: widget.colorsName[_indexSelected],
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
),
),
],
),
),
Expanded(
child: SizedBox(
height: 24.0,
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: NeverScrollableScrollPhysics(),
reverse: true,
itemCount: widget.colors.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: GestureDetector(
onTap: () {
setState(() {
_indexSelected = index;
});
},
child: Container(
width: 24.0,
height: 24.0,
decoration: BoxDecoration(
color: widget.colors[index],
shape: BoxShape.circle,
border: Border.all(
color: Colors.white,
width: _indexSelected == index ? 4.0 : 0.0,
),
boxShadow: [
_indexSelected == index
? BoxShadow(
color: Color(0xFF757575),
blurRadius: 5.0,
offset: Offset(0.0, 4.0),
)
: BoxShadow(),
],
),
),
),
);
},
),
),
),
],
);
}
}
class WidgetChooseSize extends StatefulWidget {
final List<String> listSize = [
'XL',
'S',
'M',
'L',
];
@override
_WidgetChooseSizeState createState() => _WidgetChooseSizeState();
}
class _WidgetChooseSizeState extends State<WidgetChooseSize> {
int _indexSelected;
@override
void initState() {
_indexSelected = widget.listSize.length - 1;
super.initState();
}
@override
Widget build(BuildContext context) {
return Row(
children: <Widget>[
RichText(
text: TextSpan(
children: [
TextSpan(
text: 'Size: ',
style: TextStyle(color: Colors.black87),
),
TextSpan(
text: widget.listSize[_indexSelected],
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.w600,
),
),
],
),
),
Expanded(
child: SizedBox(
height: 24.0,
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: NeverScrollableScrollPhysics(),
reverse: true,
itemCount: widget.listSize.length,
itemBuilder: (context, index) {
return Row(
children: <Widget>[
Text(widget.listSize[index]),
Radio(
value: index,
groupValue: _indexSelected,
activeColor: Color(0xFF32312D),
onChanged: (index) {
setState(() {
_indexSelected = index;
});
},
),
],
);
},
),
),
),
],
);
}
}
class WidgetAddToBag extends StatelessWidget {
@override
Widget build(BuildContext context) {
var mediaQuery = MediaQuery.of(context);
return Container(
height: (mediaQuery.size.height - mediaQuery.size.height / 1.1),
child: Material(
type: MaterialType.canvas,
color: Color(0xFF32312D),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(36.0),
topRight: Radius.circular(36.0),
),
child: InkWell(
onTap: () {
showBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return WidgetMyCart();
},
);
},
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.topCenter,
child: Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Text(
'Add to bag +',
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
fontWeight: FontWeight.w600,
),
),
),
),
],
),
),
),
);
}
}
class WidgetMyCart extends StatefulWidget {
@override
_WidgetMyCartState createState() => _WidgetMyCartState();
}
class _WidgetMyCartState extends State<WidgetMyCart> {
List<Cart> listMyCart = [];
@override
void initState() {
listMyCart
..add(Cart(
productName: 'Haicila Two Tone V-neck Blouse',
price: 89000,
size: 'M',
quantity: 1,
color: 'Black',
image: 'assets/images/img_item_cart_1.jpeg'))
..add(Cart(
productName: 'Y&F Samhita Plain Bodycon',
price: 159000,
size: 'L',
quantity: 1,
color: 'Maroon',
image: 'assets/images/header_1.jpg'));
super.initState();
}
@override
Widget build(BuildContext context) {
var mediaQuery = MediaQuery.of(context).size;
return BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 5.0,
sigmaY: 5.0,
),
child: Container(
height: mediaQuery.height / 2.0,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(48.0),
topRight: Radius.circular(48.0),
),
),
child: Padding(
padding: const EdgeInsets.only(
left: 24.0,
top: 40.0,
right: 24.0,
bottom: 20.0,
),
child: Column(
children: <Widget>[
_buildWidgetHeaderMyCart(context),
Padding(
padding: const EdgeInsets.only(top: 12.0),
child: Divider(
height: 2.0,
color: Colors.grey,
),
),
Expanded(
child: ListView.separated(
itemCount: listMyCart.length,
itemBuilder: (context, index) {
Cart cart = listMyCart[index];
String rupiahPrice =
NumberFormat('#,##0', 'id_ID').format(cart.price);
return Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Image.asset(
cart.image,
width: 48.0,
height: 48.0,
),
SizedBox(width: 8.0),
Expanded(
child: Wrap(
direction: Axis.vertical,
children: <Widget>[
Text(
cart.productName,
style: Theme.of(context)
.textTheme
.body1
.merge(TextStyle(
fontWeight: FontWeight.w500)),
),
Text(
'Rp $rupiahPrice',
style: Theme.of(context)
.textTheme
.body1
.merge(TextStyle(fontSize: 12.0)),
),
Text(
'Size: ${cart.size}',
style: Theme.of(context)
.textTheme
.body1
.merge(TextStyle(
fontSize: 12.0,
color: Colors.grey,
)),
),
],
),
),
WidgetControllerQuantity(cart.quantity),
],
),
);
},
separatorBuilder: (context, index) {
return Divider(
height: 2.0,
color: Colors.grey,
);
},
),
),
Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Divider(
thickness: 2.0,
color: Colors.black,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Total amount',
style: Theme.of(context).textTheme.body1.merge(
TextStyle(color: Colors.grey),
)),
Text('Rp 248.000',
style: Theme.of(context).textTheme.body1.merge(
TextStyle(fontWeight: FontWeight.w600),
)),
],
),
SizedBox(height: 8.0),
SizedBox(
width: mediaQuery.width,
child: RaisedButton(
onPressed: () {},
child: Text(
'Check out',
style: TextStyle(color: Colors.white),
),
padding: EdgeInsets.symmetric(vertical: 12.0),
color: Color(0xFF32312D),
),
)
],
),
),
),
);
}
Widget _buildWidgetHeaderMyCart(context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'My Cart',
style: Theme.of(context).textTheme.body1.merge(TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
)),
),
Text('2 items', style: Theme.of(context).textTheme.caption),
],
);
}
}
class WidgetControllerQuantity extends StatefulWidget {
final int qty;
WidgetControllerQuantity(this.qty);
@override
_WidgetControllerQuantityState createState() =>
_WidgetControllerQuantityState();
}
class _WidgetControllerQuantityState extends State<WidgetControllerQuantity> {
int qty;
@override
void initState() {
qty = widget.qty;
super.initState();
}
@override
Widget build(BuildContext context) {
return Row(
children: <Widget>[
GestureDetector(
onTap: () {
if (qty == 1) return;
setState(() {
qty -= 1;
});
},
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Icon(
Icons.remove,
size: 20.0,
color: Colors.black54,
),
),
),
Text('$qty'),
GestureDetector(
onTap: () {
if (qty == 10) return;
setState(() {
qty += 1;
});
},
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Icon(
Icons.add,
size: 20.0,
color: Colors.black54,
),
),
),
],
);
}
}
class Cart {
String productName;
int price;
String size;
int quantity;
String color;
String image;
Cart(
{this.productName,
this.price,
this.size,
this.quantity,
this.color,
this.image});
}
| 0 |
mirrored_repositories/Flutter-UI-Challenge-Fashion-App | mirrored_repositories/Flutter-UI-Challenge-Fashion-App/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_ui_fashion/main.dart';
void main() {
/*testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});*/
}
| 0 |
mirrored_repositories/Componentes-en-Flutter | mirrored_repositories/Componentes-en-Flutter/lib/main.dart | import 'package:componenetesapp/src/pages/card_page.dart';
import 'package:flutter/material.dart';
import 'package:componenetesapp/src/routes/routes.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
// import 'package:componenetesapp/src/pages/alert_page.dart';
// import 'package:componenetesapp/src/pages/avatar_page.dart';
// // import 'package:componenetes/src/pages/home_temp.dart';
// import 'package:componenetesapp/src/pages/home_page.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('es', 'US'), // English
const Locale('es', 'ES'), // Spanish
// .. other locales the app suports
],
title: 'Componenetes',
debugShowCheckedModeBanner: false,
// home: HomePages());
initialRoute: '/',
routes: getApplicationRoutes(),
onGenerateRoute: (settings) {
return MaterialPageRoute(builder: (context) => CardPage());
},
);
}
}
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/routes/routes.dart | import 'package:componenetesapp/src/pages/alert_page.dart';
import 'package:componenetesapp/src/pages/animate.dart';
import 'package:componenetesapp/src/pages/avatar_page.dart';
import 'package:componenetesapp/src/pages/card_page.dart';
import 'package:componenetesapp/src/pages/home_page.dart';
import 'package:componenetesapp/src/pages/input_page.dart';
import 'package:flutter/material.dart';
Map<String, WidgetBuilder> getApplicationRoutes() {
return <String, WidgetBuilder>{
'/': (BuildContext context) => HomePages(),
'alert': (BuildContext context) => AlertPage(),
'avatar': (BuildContext context) => AvatarPage(),
'card': (BuildContext context) => CardPage(),
'animatedContainer': (BuildContext context) => AnimateContainerPage(),
'inputs': (BuildContext context) => InputPage(),
};
}
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/pages/home_temp.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class HomePagesTemps extends StatelessWidget {
final opciones = ["Uno", "Dos", "Tres", "Cuatro", "Cinco"];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Hola Christina"),
),
body: ListView(children: _crearItemCorta()),
);
}
/*
List<Widget> _crearItems() {
List<Widget> lista = new List<Widget>();
for (String opt in opciones) {
final tempWidget = ListTile(
title: Text(opt),
);
lista..add(tempWidget)..add(Divider());
}
return lista;
}
*/
List<Widget> _crearItemCorta() {
var widgets = opciones.map((item) {
return Column(
children: <Widget>[
ListTile(
title: Text(item + "!"),
subtitle: Text('Cualquier cosa'),
leading: Icon(Icons.account_balance_wallet),
trailing: Icon(Icons.keyboard_arrow_right),
onTap: () {},
),
Divider(),
],
);
}).toList();
return widgets;
}
}
/*
final List<String> entries = <String>['Primera','Segunda','Tercera'];
ListView.Builder(
padding: const EdgeInsets.all(8),
itemCount: entries.length,
itemBuilder: (BuildContext Context, int index){
return Container(
height: 50,
child: Center(child: Text('Entry ${entries[index]}')),
);
}
);
*/
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/pages/home_page.dart | // import 'package:componenetesapp/src/pages/alert_page.dart';
import 'package:componenetesapp/src/providers/menu.dart';
import 'package:componenetesapp/src/utils/icono_util.dart';
import 'package:flutter/material.dart';
class HomePages extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('Flutter Componentes App'),
),
body: _lista(),
);
}
Widget _lista() {
// print(menuProvider.opciones);
return FutureBuilder(
future: menuProvider.cargarData(),
initialData: [],
builder: (context, AsyncSnapshot<List<dynamic>> snapshot) {
return ListView(
children: _listaItems(
snapshot.data,
context,
));
},
);
}
List<Widget> _listaItems(List<dynamic> data, BuildContext context) {
final List<Widget> opciones = [];
data.forEach((opt) {
final widgeTemp = ListTile(
title: Text(opt['texto']),
leading: getIcon(opt['icon']),
trailing: Icon(Icons.keyboard_arrow_right, color: Colors.blue),
onTap: () {
Navigator.pushNamed(context, opt['ruta']);
// final route = MaterialPageRoute(builder: (context) => AlertPage());
// Navigator.push(context, route);
},
);
opciones..add(widgeTemp)..add(Divider());
});
return opciones;
}
}
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/pages/input_page.dart | import 'package:flutter/material.dart';
class InputPage extends StatefulWidget {
@override
_InputPageState createState() => _InputPageState();
}
class _InputPageState extends State<InputPage> {
String _nombre = '';
String _email = '';
String _date = '';
List<String> _poderes = ['Volar', 'Rayos X', 'Super Aliento', 'Super Fuerza'];
String _opcionesSelecionadas = 'Volar';
TextEditingController _inputFielDateController = new TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('Inputs de Texto'),
),
body: Container(
color: Colors.black12,
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
children: <Widget>[
_crearInput(),
Divider(),
_crearEmail(),
Divider(),
_crearPass(),
Divider(),
_crearDates(context),
Divider(),
_crearDropDown(),
Divider(),
_crearPersona(),
Divider(),
],
),
),
);
}
Widget _crearInput() {
return TextField(
// autofocus: true,
textCapitalization: TextCapitalization.sentences,
decoration: InputDecoration(
fillColor: Colors.black,
focusColor: Colors.black87,
hoverColor: Colors.black12,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0),
),
counter: Text('Letras ${_nombre.length}'),
hintText: 'Nombre de la Persona ',
labelText: 'nombre',
helperText: 'Solo es el nombre',
suffixIcon: Icon(
Icons.accessibility,
color: Colors.black12,
),
icon: Icon(Icons.account_circle, color: Colors.black)),
onChanged: (valor) {
setState(() {
_nombre = valor;
});
},
);
}
Widget _crearEmail() {
return TextField(
// autofocus: true,
// textCapitalization: TextCapitalization.sentences,
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
fillColor: Colors.black,
focusColor: Colors.black87,
hoverColor: Colors.black12,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0),
),
// counter: Text('Letras ${_nombre.length}'),
hintText: 'Email ',
labelText: 'Email',
// helperText: 'Correo Electronico',
suffixIcon: Icon(
Icons.alternate_email,
color: Colors.black12,
),
icon: Icon(Icons.email, color: Colors.black)),
onChanged: (valor) => setState(() {
_email = valor;
}));
}
Widget _crearPass() {
return TextField(
// autofocus: true,
// textCapitalization: TextCapitalization.sentences,
// keyboardType: TextInputType.emailAddress,
obscureText: true,
decoration: InputDecoration(
fillColor: Colors.black,
focusColor: Colors.black87,
hoverColor: Colors.black12,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0),
),
// counter: Text('Letras ${_nombre.length}'),
hintText: 'Password ',
labelText: 'Password',
// helperText: 'Contrase;a',
suffixIcon: Icon(
Icons.lock,
color: Colors.black12,
),
icon: Icon(Icons.lock_outline, color: Colors.black)),
// onChanged: (valor) => setState(() {
// _email = valor;
// })
);
}
Widget _crearDates(BuildContext context) {
return TextField(
// autofocus: true,
// textCapitalization: TextCapitalization.sentences,
// keyboardType: TextInputType.emailAddress,
// obscureText: true,
enableInteractiveSelection: false,
controller: _inputFielDateController,
decoration: InputDecoration(
fillColor: Colors.black,
focusColor: Colors.black87,
hoverColor: Colors.black12,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0),
),
// counter: Text('Letras ${_nombre.length}'),
hintText: 'Nacimiento ',
labelText: 'Nacimiento',
// helperText: 'Fecha de Nacimiento',
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black12,
),
icon: Icon(Icons.calendar_today, color: Colors.black)),
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
_selectDate(context);
},
);
}
_selectDate(BuildContext context) async {
DateTime picked = await showDatePicker(
context: context,
initialDate: new DateTime.now(),
firstDate: new DateTime(2018),
lastDate: new DateTime(2025),
locale: Locale('es', 'ES'));
if (picked != null) {
setState(() {
_date = picked.toString();
_inputFielDateController.text = _date;
});
}
}
List<DropdownMenuItem<String>> getOpcionesDropdown() {
List<DropdownMenuItem<String>> lista = new List();
_poderes.forEach((poder) {
lista.add(DropdownMenuItem(
child: Text(poder),
value: poder,
));
});
return lista;
}
Widget _crearDropDown() {
return Row(
children: <Widget>[
Icon(Icons.select_all),
SizedBox(
width: 30.0,
),
DropdownButton(
value: _opcionesSelecionadas,
items: getOpcionesDropdown(),
onChanged: (opt) {
// print(opt);
_opcionesSelecionadas = opt;
},
),
],
);
}
Widget _crearPersona() {
return ListTile(
title: Text('Nombre es: $_nombre'),
subtitle: Text('Email: $_email'),
trailing: Text(_opcionesSelecionadas),
);
}
}
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/pages/animate.dart | import 'dart:math';
import 'package:flutter/material.dart';
class AnimateContainerPage extends StatefulWidget {
@override
_AnimateContainerPageState createState() => _AnimateContainerPageState();
}
class _AnimateContainerPageState extends State<AnimateContainerPage> {
double _ancho = 50.0;
double _altura = 50.0;
Color _colores = Colors.pink;
BorderRadiusGeometry _borders = BorderRadius.circular(8.0);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('Conteiner Animado'),
),
body: Container(
color: Colors.black12,
child: Center(
child: AnimatedContainer(
// color: Colors.black,
duration: Duration(seconds: 1),
curve: Curves.fastOutSlowIn,
width: _ancho,
height: _altura,
decoration: BoxDecoration(borderRadius: _borders, color: _colores),
),
),
),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.black,
child: Icon(Icons.play_arrow),
onPressed: _cambiarForma,
),
);
}
_cambiarForma() {
final randon = Random();
setState(() {
_ancho = randon.nextInt(300).toDouble();
_altura = randon.nextInt(300).toDouble();
_colores = Color.fromRGBO(
randon.nextInt(255), randon.nextInt(255), randon.nextInt(255), 1);
_borders = BorderRadius.circular(randon.nextInt(100).toDouble());
});
}
}
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/pages/alert_page.dart | import 'package:flutter/material.dart';
class AlertPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('Alert Page'),
),
body: Center(
child: RaisedButton(
child: Text('Mostrar Alerta'),
textColor: Colors.white,
shape: StadiumBorder(),
color: Colors.black,
onPressed: () => _mostrarAlerta(context),
),
),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.black,
child: Icon(Icons.home),
onPressed: () {
// Navigator.pop(context);
Navigator.pop(context);
},
),
);
}
void _mostrarAlerta(BuildContext context) {
showDialog(
context: context,
barrierDismissible: true,
builder: (context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0)),
title: Text('Titulo'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(('Este es el contenido de la caja de alerta')),
FlutterLogo(
size: 200.0,
)
],
),
actions: <Widget>[
FlatButton(
child: Text("Cancelar"),
onPressed: () => Navigator.of(context).pop(),
),
FlatButton(
child: Text("Ok"),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
}
}
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/pages/avatar_page.dart | import 'package:flutter/material.dart';
class AvatarPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.black,
title: Text('Avatar Page'),
actions: <Widget>[
Container(
padding: EdgeInsets.all(5.0),
child: CircleAvatar(
backgroundImage: NetworkImage(
'https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/stan-lee-arrives-at-the-premiere-of-disney-and-marvels-news-photo-950501274-1542049801.jpg?crop=1.00xw:0.512xh;0,0.0630xh&resize=480:*'),
radius: 25.0,
),
),
Container(
margin: EdgeInsets.only(right: 10.0),
child: CircleAvatar(
child: Text('SL'),
backgroundColor: Colors.brown,
),
)
],
),
body: Container(
color: Colors.black12,
child: Center(
child: FadeInImage(
image: NetworkImage(
'https://static01.nyt.com/images/2018/11/13/obituaries/13LEE3/13LEE3-facebookJumbo.jpg'),
placeholder: AssetImage('assets/jar.gif'),
fadeInDuration: Duration(milliseconds: 200),
),
),
),
);
}
}
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/pages/card_page.dart | import 'package:flutter/material.dart';
class CardPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Card Page'),
),
body: ListView(
padding: EdgeInsets.all(10.0),
children: <Widget>[
_cardTipo1(),
SizedBox(height: 30.0),
_cardTipo2(),
SizedBox(height: 30.0),
_cardTipo1(),
SizedBox(height: 30.0),
_cardTipo2(),
SizedBox(height: 30.0),
_cardTipo1(),
SizedBox(height: 30.0),
_cardTipo2(),
SizedBox(height: 30.0),
_cardTipo1(),
SizedBox(height: 30.0),
_cardTipo2(),
SizedBox(height: 30.0),
_cardTipo1(),
SizedBox(height: 30.0),
_cardTipo2(),
SizedBox(height: 30.0),
],
),
);
}
Widget _cardTipo1() {
return Card(
elevation: 10.0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: Column(
children: <Widget>[
ListTile(
leading: Icon(
Icons.photo_album,
color: Colors.blue,
),
title: Text('Soy el Titulo de esta tarjeta'),
subtitle: Text(
'Esto es un ejemplo de algo qeu debe estar ahy no tiene nada pero ahy esta'),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlatButton(
child: Text('Cancelar'),
onPressed: () {},
),
FlatButton(
child: Text('Ok'),
onPressed: () {},
)
],
)
],
),
);
}
Widget _cardTipo2() {
final card = Container(
child: Column(
children: <Widget>[
FadeInImage(
image: NetworkImage(
'https://hollanderdesign.com/app/uploads/2014/12/haven-meadows-2048x1366.jpg'),
placeholder: AssetImage('assets/jar.gif'),
height: 300.0,
fit: BoxFit.cover,
// fadeInDuration: Duration(milliseconds: 200),
),
Container(
padding: EdgeInsets.all(10.0),
child: Text('No tengo idea de que poner'))
],
),
);
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
color: Colors.white,
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black26,
blurRadius: 10.0,
spreadRadius: 2.0,
offset: Offset(2.0, 10.0)),
]),
child: ClipRRect(
borderRadius: BorderRadius.circular(30.0),
child: card,
),
);
}
}
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/utils/icono_util.dart | import 'package:flutter/material.dart';
final _icons = <String, IconData>{
'add_alert': Icons.add_alert,
'accessibility': Icons.accessibility,
'folder_open': Icons.folder_open,
'donut_large': Icons.donut_large,
'input': Icons.input,
};
Icon getIcon(String nombreIcono) {
return Icon(
_icons[nombreIcono],
color: Colors.black,
);
}
| 0 |
mirrored_repositories/Componentes-en-Flutter/lib/src | mirrored_repositories/Componentes-en-Flutter/lib/src/providers/menu.dart | import 'dart:convert';
import 'package:flutter/services.dart' show rootBundle;
class _MenuProvider {
List<dynamic> opciones = [];
_MenuProvider() {
cargarData();
}
Future<List<dynamic>> cargarData() async {
final resp = await rootBundle.loadString('data/menu-opts.json');
Map dataMap = json.decode(resp);
// print(dataMap['rutas']);
opciones = dataMap['rutas'];
return opciones;
}
}
final menuProvider = new _MenuProvider();
| 0 |
mirrored_repositories/Componentes-en-Flutter | mirrored_repositories/Componentes-en-Flutter/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:componenetesapp/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/Corona-Meter-App | mirrored_repositories/Corona-Meter-App/lib/faqsource.dart | import 'package:flutter/material.dart';
class FAQsource{
static List FAQ = [
{
"question": "What is a coronavirus?",
"answer":
"Coronaviruses are a large family of viruses which may cause illness in animals or humans. In humans, several coronaviruses are known to cause respiratory infections ranging from the common cold to more severe diseases such as Middle East Respiratory Syndrome (MERS) and Severe Acute Respiratory Syndrome (SARS). The most recently discovered coronavirus causes coronavirus disease COVID-19."
},
{
"question": "What is COVID-19?",
"answer":
"COVID-19 is the infectious disease caused by the most recently discovered coronavirus. This new virus and disease were unknown before the outbreak began in Wuhan, China, in December 2019."
},
{
"question": "What are the symptoms of COVID-19?",
"answer":
"The most common symptoms of COVID-19 are fever, tiredness, and dry cough. Some patients may have aches and pains, nasal congestion, runny nose, sore throat or diarrhea. These symptoms are usually mild and begin gradually. Some people become infected but don’t develop any symptoms and don't feel unwell. Most people (about 80%) recover from the disease without needing special treatment. Around 1 out of every 6 people who gets COVID-19 becomes seriously ill and develops difficulty breathing. Older people, and those with underlying medical problems like high blood pressure, heart problems or diabetes, are more likely to develop serious illness. People with fever, cough and difficulty breathing should seek medical attention."
},
{
"question": "How does COVID-19 spread?",
"answer":
"People can catch COVID-19 from others who have the virus. The disease can spread from person to person through small droplets from the nose or mouth which are spread when a person with COVID-19 coughs or exhales. These droplets land on objects and surfaces around the person. Other people then catch COVID-19 by touching these objects or surfaces, then touching their eyes, nose or mouth. People can also catch COVID-19 if they breathe in droplets from a person with COVID-19 who coughs out or exhales droplets. This is why it is important to stay more than 1 meter (3 feet) away from a person who is sick. \nWHO is assessing ongoing research on the ways COVID-19 is spread and will continue to share updated findings."
},
{
"question":
"Can the virus that causes COVID-19 be transmitted through the air?",
"answer":
"Studies to date suggest that the virus that causes COVID-19 is mainly transmitted through contact with respiratory droplets rather than through the air"
},
{
"question": "Can CoVID-19 be caught from a person who has no symptoms?",
"answer":
"The main way the disease spreads is through respiratory droplets expelled by someone who is coughing. The risk of catching COVID-19 from someone with no symptoms at all is very low. However, many people with COVID-19 experience only mild symptoms. This is particularly true at the early stages of the disease. It is therefore possible to catch COVID-19 from someone who has, for example, just a mild cough and does not feel ill. WHO is assessing ongoing research on the period of transmission of COVID-19 and will continue to share updated findings. "
},
{
"question":
"Can I catch COVID-19 from the feces of someone with the disease?",
"answer":
"The risk of catching COVID-19 from the feces of an infected person appears to be low. While initial investigations suggest the virus may be present in feces in some cases, spread through this route is not a main feature of the outbreak. WHO is assessing ongoing research on the ways COVID-19 is spread and will continue to share new findings. Because this is a risk, however, it is another reason to clean hands regularly, after using the bathroom and before eating."
},
{
"question": "How likely am I to catch COVID-19?",
"answer":
"The risk depends on where you are - and more specifically, whether there is a COVID-19 outbreak unfolding there.\nFor most people in most locations the risk of catching COVID-19 is still low. However, there are now places around the world (cities or areas) where the disease is spreading. For people living in, or visiting, these areas the risk of catching COVID-19 is higher. Governments and health authorities are taking vigorous action every time a new case of COVID-19 is identified. Be sure to comply with any local restrictions on travel, movement or large gatherings. Cooperating with disease control efforts will reduce your risk of catching or spreading COVID-19.\nCOVID-19 outbreaks can be contained and transmission stopped, as has been shown in China and some other countries. Unfortunately, new outbreaks can emerge rapidly. It’s important to be aware of the situation where you are or intend to go. WHO publishes daily updates on the COVID-19 situation worldwide."
},
{
"question": "Who is at risk of developing severe illness?",
"answer":
"While we are still learning about how COVID-2019 affects people, older persons and persons with pre-existing medical conditions (such as high blood pressure, heart disease, lung disease, cancer or diabetes) appear to develop serious illness more often than others. "
},
{
"question": "Should I wear a mask to protect myself?",
"answer":
"Only wear a mask if you are ill with COVID-19 symptoms (especially coughing) or looking after someone who may have COVID-19. Disposable face mask can only be used once. If you are not ill or looking after someone who is ill then you are wasting a mask. There is a world-wide shortage of masks, so WHO urges people to use masks wisely.\nWHO advises rational use of medical masks to avoid unnecessary wastage of precious resources and mis-use of masks\nThe most effective ways to protect yourself and others against COVID-19 are to frequently clean your hands, cover your cough with the bend of elbow or tissue and maintain a distance of at least 1 meter (3 feet) from people who are coughing or sneezing"
},
{
"question":
"Are antibiotics effective in preventing or treating the COVID-19?",
"answer":
"No. Antibiotics do not work against viruses, they only work on bacterial infections. COVID-19 is caused by a virus, so antibiotics do not work. Antibiotics should not be used as a means of prevention or treatment of COVID-19. They should only be used as directed by a physician to treat a bacterial infection. "
}
];
} | 0 |
mirrored_repositories/Corona-Meter-App | mirrored_repositories/Corona-Meter-App/lib/main.dart | import 'package:flutter/material.dart';
import 'screens/home_screen.dart';
void main() {
runApp(CoronaMeter());
}
class CoronaMeter extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: HomeScreen(),
);
}
}
| 0 |
mirrored_repositories/Corona-Meter-App | mirrored_repositories/Corona-Meter-App/lib/header.dart | import 'package:coronameterapp/screens/donate.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'screens/faq_screen.dart';
import 'screens/donate.dart';
import 'screens/aboutscreen.dart';
class Header extends StatefulWidget {
@override
_HeaderState createState() => _HeaderState();
}
class _HeaderState extends State<Header> {
@override
Widget build(BuildContext context) {
return ClipPath(
clipper: MyClipper(),
child: Container(
padding: EdgeInsets.only(left: 40, top: 50, right: 40),
height: 350,
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
Color(0xFF3383CD),
Color(0xFF11249F),
],
),
),
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CircleAvatar(backgroundImage: AssetImage('images/circle-cropped.png'),),
SizedBox(width: 10),
Text(
'Corona Meter',
style: TextStyle(
fontSize:24,
fontWeight: FontWeight.bold,
color: Colors.blue[100],
),
),
],
),
Divider(color: Colors.blue,),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Text(
'Stay Home,\nStay Safe...',
style: TextStyle(
fontSize: 38,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
SizedBox(
height: 40,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
GestureDetector(
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (context){
return AboutScreen();
}));
},
child: Container(
child: Column(
children: <Widget>[
Icon(
FontAwesomeIcons.info,
color: Colors.white,
size: 25,
),
SizedBox(height: 5),
Text('About',style: TextStyle(color: Colors.white70,fontWeight: FontWeight.bold),),
],
),
),
),
GestureDetector(
onTap:(){
Navigator.push(context, MaterialPageRoute(builder: (context){
return Donate();
}));
},
child: Container(
child: Column(
children: <Widget>[
Icon(
FontAwesomeIcons.donate,
color: Colors.white,
size: 25,
),
SizedBox(height: 5),
Text('Donate',style: TextStyle(color: Colors.white70,fontWeight: FontWeight.bold),),
],
),
),
),
GestureDetector(
onTap:(){
Navigator.push(context, MaterialPageRoute(builder: (context){
return FAQscreen();
}));
},
child: Container(
child: Column(
children: <Widget>[
Icon(
FontAwesomeIcons.solidQuestionCircle,
color: Colors.white,
size: 25,
),
SizedBox(height: 5),
Text('FAQs',style: TextStyle(color: Colors.white70,fontWeight: FontWeight.bold),),
],
),
),
),
],
),
],
),
),
);
}
}
class MyClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var path = Path();
path.lineTo(0, size.height - 80);
path.quadraticBezierTo(
size.width / 2, size.height, size.width, size.height - 80);
path.lineTo(size.width, 0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return false;
}
}
| 0 |
mirrored_repositories/Corona-Meter-App/lib | mirrored_repositories/Corona-Meter-App/lib/panels/mostAffected.dart | import 'package:flutter/material.dart';
class MostAffected extends StatelessWidget {
final List countryData;
MostAffected({this.countryData});
@override
Widget build(BuildContext context) {
return Container(
child: ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context,index){
return Container(
margin: EdgeInsets.symmetric(vertical: 5,horizontal: 10),
child: Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
Colors.yellow,
Colors.orangeAccent,
],
),
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: <Widget>[
Image.network(countryData[index]['countryInfo']['flag'],height: 40,),
SizedBox(
width: 10,
),
Text(countryData[index]['country'],style: TextStyle(
fontWeight: FontWeight.bold,
),),
SizedBox(
width: 10,
),
Text('Deaths:'+ countryData[index]['deaths'].toString(),style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.red,
),),
],
),
),
);
},itemCount: 5),
);
}
}
| 0 |
mirrored_repositories/Corona-Meter-App/lib | mirrored_repositories/Corona-Meter-App/lib/panels/countrypanel.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:pie_chart/pie_chart.dart';
class CountryPanel extends StatelessWidget {
@override
final Map countryInfo;
CountryPanel({this.countryInfo});
Widget build(BuildContext context) {
return countryInfo==null?Text('Sorry'):Container(
width: double.infinity ,
padding: EdgeInsets.all(10),
margin: EdgeInsets.all(20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: <Color>[
Colors.yellow,
Colors.orangeAccent,
],
),
),
child: Column(
children: <Widget>[
CircleAvatar(
radius: 80,
backgroundImage: NetworkImage(countryInfo['countryInfo']['flag']),
),
SizedBox(height: 10),
Divider(color: Colors.indigo),
SizedBox(height: 10),
Text(countryInfo['country'],style: TextStyle(fontSize: 40,fontWeight: FontWeight.bold,),),
Container(
child: GridView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2,childAspectRatio: 2),
children: <Widget>[
StatusBox(boxColor: Colors.red[100],textColor: Colors.red[900],title: 'CONFIRMED',data: countryInfo['cases'].toString()),
StatusBox(boxColor: Colors.blue[100],textColor: Colors.blue[900],title: 'ACTIVE',data: countryInfo['active'].toString()),
StatusBox(boxColor: Colors.lightGreen,textColor: Colors.green[900],title: 'RECOVERED',data: countryInfo['recovered'].toString()),
StatusBox(boxColor: Colors.grey,textColor: Colors.black,title: 'DEATHS',data: countryInfo['deaths'].toString(),),
],
),
),
SizedBox(height: 20),
PieChart(
dataMap: {
'Active': countryInfo['active'].toDouble(),
'Recovered': countryInfo['recovered'].toDouble(),
'Deaths': countryInfo['deaths'].toDouble(),
},
animationDuration: Duration(milliseconds: 800),
chartLegendSpacing: 32.0,
chartRadius: MediaQuery.of(context).size.width / 2.7,
showChartValuesInPercentage: true,
showChartValues: true,
showChartValuesOutside: false,
chartValueBackgroundColor: Colors.grey[200],
showLegends: true,
legendPosition: LegendPosition.right,
decimalPlaces: 1,
showChartValueLabel: true,
initialAngle: 0,
chartValueStyle: defaultChartValueStyle.copyWith(
color: Colors.blueGrey[900].withOpacity(0.9),
),
chartType: ChartType.disc,
),
SizedBox(height: 20),
Container(
height: 180,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Column(
children: <Widget>[
Container(
height: 40,
color: Colors.grey,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(FontAwesomeIcons.calendar,color: Colors.black,size: 20,),
SizedBox(width: 90),
Text(
'Daily Updates',
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
Container(
padding: EdgeInsets.all(10),
child: Row(
children: <Widget>[
Icon(
FontAwesomeIcons.arrowCircleRight,
size: 18,
),
SizedBox(width: 30),
Text(
'New cases recorded today : '+ countryInfo['todayCases'].toString(),
style: TextStyle(color: Colors.red,fontSize: 15,fontWeight: FontWeight.bold),
),
],
),
),
Container(
padding: EdgeInsets.all(10),
child: Row(
children: <Widget>[
Icon(
FontAwesomeIcons.arrowCircleRight,
size: 18,
),
SizedBox(width: 30),
Text(
'New deaths recorded today : '+ countryInfo['todayDeaths'].toString(),
style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold),
),
],
),
),
Container(
padding: EdgeInsets.all(10),
child: Row(
children: <Widget>[
Icon(
FontAwesomeIcons.arrowCircleRight,
size: 18,
),
SizedBox(width: 30),
Text(
'Cases per one million people : '+ countryInfo['casesPerOneMillion'].toString(),
style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold),
),
],
),
),
],
),
),
],
),
);
}
}
class StatusBox extends StatelessWidget {
final Color boxColor;
final Color textColor;
final String title;
final String data;
StatusBox({this.boxColor,this.textColor,this.title,this.data});
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
return Container(
margin: EdgeInsets.all(8),
height: 80,
width: width/2,
decoration: BoxDecoration(
color: boxColor,
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
title,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: textColor,
),
),
SizedBox(
height: 10,
),
Text(
data,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/Corona-Meter-App/lib | mirrored_repositories/Corona-Meter-App/lib/panels/worldwide_panel.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class Worldwide extends StatelessWidget {
final Map worldData;
Worldwide({this.worldData});
@override
Widget build(BuildContext context) {
return Container(
child: GridView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2,childAspectRatio: 2),
children: <Widget>[
StatusBox(boxColor: Colors.red[100],textColor: Colors.red[900],title: 'CONFIRMED',data: worldData['cases'].toString()),
StatusBox(boxColor: Colors.blue[100],textColor: Colors.blue[900],title: 'ACTIVE',data: worldData['active'].toString()),
StatusBox(boxColor: Colors.lightGreen,textColor: Colors.green[900],title: 'RECOVERED',data: worldData['recovered'].toString()),
StatusBox(boxColor: Colors.grey,textColor: Colors.black,title: 'DEATHS',data: worldData['deaths'].toString(),),
],
),
);
}
}
class StatusBox extends StatelessWidget {
final Color boxColor;
final Color textColor;
final String title;
final String data;
StatusBox({this.boxColor,this.textColor,this.title,this.data});
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
return Container(
margin: EdgeInsets.all(8),
height: 80,
width: width/2,
decoration: BoxDecoration(
color: boxColor,
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
title,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: textColor,
),
),
SizedBox(
height: 10,
),
Text(
data,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
],
),
);
}
}
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.