repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/SwiggyUI/lib/views/mobile | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/swiggy_safety_banner_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
class SwiggySafetyBannerView extends StatelessWidget {
const SwiggySafetyBannerView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
final cardWidth =
MediaQuery.of(context).size.width / (isTabletDesktop ? 3.8 : 1.2);
return Container(
margin: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.arrow_downward,
color: swiggyOrange,
),
UIHelper.horizontalSpaceExtraSmall(),
Flexible(
child: Text(
"SWIGGY's KEY MEASURES TO ENSURE SAFETY",
style: Theme.of(context).textTheme.subtitle2!.copyWith(
color: swiggyOrange,
fontSize: 15.0,
fontWeight: FontWeight.w700,
),
),
),
UIHelper.horizontalSpaceExtraSmall(),
Icon(
Icons.arrow_downward,
color: swiggyOrange,
),
],
),
UIHelper.verticalSpaceMedium(),
LimitedBox(
maxHeight: 220.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: 3,
itemBuilder: (context, index) => Container(
margin: const EdgeInsets.only(right: 10.0),
padding: const EdgeInsets.all(10.0),
width: cardWidth,
decoration: BoxDecoration(
color: Colors.orange[100],
border: Border.all(color: swiggyOrange!, width: 2.0),
borderRadius: BorderRadius.circular(10.0),
),
child: Row(
children: <Widget>[
Flexible(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'No-contact Delivery',
style: Theme.of(context).textTheme.headline6,
),
UIHelper.verticalSpaceExtraSmall(),
Text(
'Have your order dropped of at your door or gate for added safety',
style: Theme.of(context).textTheme.bodyText1,
),
],
),
),
UIHelper.verticalSpaceExtraSmall(),
TextButton(
child: Text(
'Know More',
style: Theme.of(context)
.textTheme
.headline6!
.copyWith(color: darkOrange),
),
onPressed: () {},
)
],
),
),
UIHelper.horizontalSpaceSmall(),
ClipOval(
child: Image.asset(
'assets/images/food3.jpg',
height: 90.0,
width: 90.0,
),
)
],
),
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/best_in_safety_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/mobile/spotlight_best_top_food_item.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
class BestInSafetyViews extends StatelessWidget {
final restaurants = SpotlightBestTopFood.getBestRestaurants();
BestInSafetyViews({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
final customWidth =
MediaQuery.of(context).size.width / (isTabletDesktop ? 3.8 : 1.1);
return Container(
margin: const EdgeInsets.symmetric(vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
const Icon(Icons.security),
UIHelper.horizontalSpaceExtraSmall(),
Text(
'Best in Safety',
style: Theme.of(context)
.textTheme
.headline4!
.copyWith(fontSize: 20.0),
),
const Spacer(),
Row(
children: <Widget>[
Text(
'SEE ALL',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontWeight: FontWeight.bold),
),
UIHelper.horizontalSpaceExtraSmall(),
ClipOval(
child: Container(
alignment: Alignment.center,
color: swiggyOrange,
height: 25.0,
width: 25.0,
child: const Icon(
Icons.arrow_forward_ios,
size: 12.0,
color: Colors.white,
),
),
)
],
)
],
),
UIHelper.verticalSpaceExtraSmall(),
Text(
'Restaurants with best safety standards',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey),
),
],
),
),
UIHelper.verticalSpaceMedium(),
LimitedBox(
maxHeight: 270.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: restaurants.length,
itemBuilder: (context, index) => SizedBox(
width: customWidth,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SpotlightBestTopFoodItem(restaurant: restaurants[index][0]),
SpotlightBestTopFoodItem(restaurant: restaurants[index][1])
],
),
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/in_the_spotlight_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/mobile/spotlight_best_top_food_item.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
class InTheSpotlightView extends StatelessWidget {
final restaurants = SpotlightBestTopFood.getSpotlightRestaurants();
InTheSpotlightView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
final customWidth =
MediaQuery.of(context).size.width / (isTabletDesktop ? 3.8 : 1.1);
return Container(
margin: const EdgeInsets.symmetric(vertical: 15.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
UIHelper.verticalSpaceSmall(),
_buildSpotlightHeaderView(context),
UIHelper.verticalSpaceMedium(),
LimitedBox(
maxHeight: 270.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: restaurants.length,
itemBuilder: (context, index) => SizedBox(
width: customWidth,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SpotlightBestTopFoodItem(restaurant: restaurants[index][0]),
SpotlightBestTopFoodItem(restaurant: restaurants[index][1])
],
),
),
),
)
],
),
);
}
Container _buildSpotlightHeaderView(BuildContext context) => Container(
margin: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
const Icon(Icons.shopping_basket, size: 20.0),
UIHelper.horizontalSpaceSmall(),
Text(
'In the Spotlight!',
style: Theme.of(context)
.textTheme
.headline4!
.copyWith(fontSize: 20.0),
)
],
),
UIHelper.verticalSpaceExtraSmall(),
Text(
'Explore sponsored partner brands',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey),
),
],
),
);
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/popular_brand_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/popular_brands.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/views/mobile/swiggy/restaurants/restaurant_detail_screen.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
class PopularBrandsView extends StatelessWidget {
final brands = PopularBrands.getPopularBrands();
PopularBrandsView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
return Container(
margin: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
UIHelper.verticalSpaceSmall(),
_buildPopularHeader(context),
LimitedBox(
maxHeight: 170.0,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0),
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: brands.length,
itemBuilder: (context, index) => InkWell(
onTap: isTabletDesktop
? () {}
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const RestaurantDetailScreen(),
),
);
},
child: Container(
margin: const EdgeInsets.only(right: 15.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey[300]!,
width: 3.0,
),
borderRadius: BorderRadius.circular(40.0),
),
child: ClipOval(
child: Image.asset(
brands[index].image,
height: 80.0,
width: 80.0,
fit: BoxFit.cover,
),
),
),
UIHelper.verticalSpaceSmall(),
Text(
brands[index].name,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontWeight: FontWeight.w500),
),
UIHelper.verticalSpace(2.0),
Text(
brands[index].minutes,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey, fontSize: 13.0),
)
],
),
),
),
),
),
)
],
),
);
}
Column _buildPopularHeader(BuildContext context) => Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text(
'Popular Brands',
style:
Theme.of(context).textTheme.headline4!.copyWith(fontSize: 20.0),
),
UIHelper.verticalSpaceExtraSmall(),
Text(
'Most ordered from around your locality',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey),
),
],
);
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/top_offer_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/mobile/spotlight_best_top_food_item.dart';
class TopOffersViews extends StatelessWidget {
final restaurants = SpotlightBestTopFood.getTopRestaurants();
TopOffersViews({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
const Icon(Icons.security),
UIHelper.horizontalSpaceExtraSmall(),
Text(
'Top Offers',
style: Theme.of(context)
.textTheme
.headline4!
.copyWith(fontSize: 20.0),
),
const Spacer(),
Row(
children: <Widget>[
Text(
'SEE ALL',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontWeight: FontWeight.bold),
),
UIHelper.horizontalSpaceExtraSmall(),
ClipOval(
child: Container(
alignment: Alignment.center,
color: swiggyOrange,
height: 25.0,
width: 25.0,
child: const Icon(
Icons.arrow_forward_ios,
size: 12.0,
color: Colors.white,
),
),
)
],
)
],
),
UIHelper.verticalSpaceExtraSmall(),
Text(
'Get 20-50% Off',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey),
),
],
),
),
UIHelper.verticalSpaceMedium(),
LimitedBox(
maxHeight: 270.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: restaurants.length,
itemBuilder: (context, index) => SizedBox(
width: MediaQuery.of(context).size.width / 1.1,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SpotlightBestTopFoodItem(restaurant: restaurants[index][0]),
SpotlightBestTopFoodItem(restaurant: restaurants[index][1])
],
),
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/popular_categories_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/popular_category.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
class PopularCategoriesView extends StatelessWidget {
final categories = PopularCategory.getPopularCategories();
PopularCategoriesView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.topLeft,
margin: const EdgeInsets.all(10.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Popular Categories',
style:
Theme.of(context).textTheme.headline4!.copyWith(fontSize: 20.0),
),
UIHelper.verticalSpaceMedium(),
LimitedBox(
maxHeight: 124.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: categories.length,
itemBuilder: (context, index) => Container(
margin: const EdgeInsets.all(10.0),
width: 70.0,
child: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Container(
height: 50.0,
color: Colors.grey[200],
),
),
Positioned(
top: 20.0,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset(
categories[index].image,
height: 40.0,
width: 40.0,
fit: BoxFit.cover,
),
UIHelper.verticalSpaceSmall(),
Text(
categories[index].name,
maxLines: 2,
textAlign: TextAlign.center,
)
],
),
),
],
)),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/swiggy_screen.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/custom_divider_view.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
import 'all_restaurants/all_restaurants_screen.dart';
import 'best_in_safety_view.dart';
import 'food_groceries_availability_view.dart';
import 'genie/genie_view.dart';
import 'in_the_spotlight_view.dart';
import 'indian_food/indian_food_view.dart';
import 'offers/offer_banner_view.dart';
import 'offers/offer_screen.dart';
import 'popular_brand_view.dart';
import 'popular_categories_view.dart';
import 'restaurants/restaurant_vertical_list_view.dart';
import 'swiggy_safety_banner_view.dart';
import 'top_offer_view.dart';
import 'top_picks_for_you_view.dart';
class SwiggyScreen extends StatelessWidget {
const SwiggyScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: <Widget>[
_buildAppBar(context),
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const FoodGroceriesAvailabilityView(),
TopPicksForYouView(),
OfferBannerView(),
const CustomDividerView(),
IndianFoodView(),
const CustomDividerView(),
InTheSpotlightView(),
const CustomDividerView(),
PopularBrandsView(),
const CustomDividerView(),
const SwiggySafetyBannerView(),
BestInSafetyViews(),
const CustomDividerView(),
TopOffersViews(),
const CustomDividerView(),
const GenieView(),
const CustomDividerView(),
PopularCategoriesView(),
const CustomDividerView(),
RestaurantVerticalListView(
title: 'Popular Restaurants',
restaurants:
SpotlightBestTopFood.getPopularAllRestaurants(),
),
const CustomDividerView(),
RestaurantVerticalListView(
title: 'All Restaurants Nearby',
restaurants:
SpotlightBestTopFood.getPopularAllRestaurants(),
isAllRestaurantNearby: true,
),
const SeeAllRestaurantBtn(),
const LiveForFoodView(),
],
),
),
)
],
),
),
);
}
Container _buildAppBar(BuildContext context) => Container(
margin: const EdgeInsets.symmetric(horizontal: 15.0),
height: 60.0,
child: Row(
children: <Widget>[
Text(
'Other',
style: Theme.of(context)
.textTheme
.headline4!
.copyWith(fontSize: 21.0),
),
UIHelper.horizontalSpaceExtraSmall(),
const Padding(
padding: EdgeInsets.only(top: 4.0),
child: Icon(Icons.keyboard_arrow_down),
),
const Spacer(),
const Icon(Icons.local_offer),
UIHelper.horizontalSpaceExtraSmall(),
InkWell(
child: Container(
padding: const EdgeInsets.all(5.0),
child: Text(
'Offer',
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 18.0),
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const OffersScreen(),
),
);
},
),
],
),
);
}
class SeeAllRestaurantBtn extends StatelessWidget {
const SeeAllRestaurantBtn({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
return Container(
margin: const EdgeInsets.symmetric(vertical: 15.0),
padding: const EdgeInsets.symmetric(horizontal: 15.0),
height: 50.0,
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(primary: darkOrange),
child: Text(
'See all restaurants',
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(color: Colors.white, fontSize: 19.0),
),
onPressed: isTabletDesktop
? () {}
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AllRestaurantsScreen(),
),
);
},
),
);
}
}
class LiveForFoodView extends StatelessWidget {
const LiveForFoodView({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(top: 20.0),
padding: const EdgeInsets.all(15.0),
height: 400.0,
color: Colors.grey[200],
child: Stack(
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'LIVE\nFOR\nFOOD',
style: Theme.of(context).textTheme.headline4!.copyWith(
color: Colors.grey[400],
fontSize: 80.0,
letterSpacing: 0.2,
height: 0.8,
),
),
UIHelper.verticalSpaceLarge(),
Text(
'MADE BY FOOD LOVERS',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey),
),
Text(
'SWIGGY HQ, BANGALORE',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey),
),
UIHelper.verticalSpaceExtraLarge(),
Row(
children: <Widget>[
Container(
height: 1.0,
width: MediaQuery.of(context).size.width / 4,
color: Colors.grey,
),
],
)
],
),
Positioned(
left: 140.0,
top: 90.0,
child: Image.asset(
'assets/images/burger.png',
height: 80.0,
width: 80.0,
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/food_groceries_availability_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/views/mobile/swiggy/genie/genie_screen.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
import 'all_restaurants/all_restaurants_screen.dart';
import 'genie/genie_grocery_card_view.dart';
import 'meat/meat_screen.dart';
class FoodGroceriesAvailabilityView extends StatelessWidget {
const FoodGroceriesAvailabilityView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
return Container(
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
child: Column(
children: <Widget>[
if (!isTabletDesktop)
Row(
children: <Widget>[
ClipRRect(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(8.0),
bottomRight: Radius.circular(8.0),
),
child: Container(
width: 10.0,
height: 140.0,
color: swiggyOrange,
),
),
UIHelper.horizontalSpaceMedium(),
Flexible(
child: Column(
children: <Widget>[
Text(
'We are now deliverying food groceries and other essentials.',
style: Theme.of(context).textTheme.headline4,
),
UIHelper.verticalSpaceSmall(),
Text(
'Food & Genie service (Mon-Sat)-6:00 am to 9:00pm. Groceries & Meat (Mon-Sat)-6:00 am to 6:00pm. Dairy (Mon-Sat)-6:00 am to 6:00pm (Sun)-6:00 am to 12:00 pm',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyText1!.copyWith(
fontSize: 16.0,
color: Colors.grey[800],
),
)
],
),
)
],
),
if (!isTabletDesktop) UIHelper.verticalSpaceLarge(),
Stack(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: InkWell(
child: Container(
height: 150.0,
color: swiggyOrange,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Align(
alignment: Alignment.topLeft,
child: FractionallySizedBox(
widthFactor: 0.7,
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Restaurants',
style: Theme.of(context)
.textTheme
.headline4!
.copyWith(color: Colors.white),
),
UIHelper.verticalSpaceExtraSmall(),
Text(
'No-contact delivery available',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.white),
)
],
),
),
),
),
const Spacer(),
Container(
height: 45.0,
padding: const EdgeInsets.symmetric(horizontal: 10.0),
color: darkOrange,
child: Row(
children: <Widget>[
Text(
'View all',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(
color: Colors.white, fontSize: 18.0),
),
UIHelper.horizontalSpaceSmall(),
const Icon(
Icons.arrow_forward,
color: Colors.white,
size: 18.0,
),
],
),
)
],
),
),
onTap: isTabletDesktop
? () {}
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AllRestaurantsScreen(),
),
);
},
),
),
Positioned(
top: -10.0,
right: -10.0,
child: ClipOval(
child: Image.asset(
'assets/images/food1.jpg',
width: 130.0,
height: 130.0,
fit: BoxFit.cover,
),
),
),
],
),
UIHelper.verticalSpaceMedium(),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
GenieGroceryCardView(
title: 'Genie',
subtitle: 'Anything you need,\ndelivered',
image: 'assets/images/food1.jpg',
onTap: isTabletDesktop
? () {}
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const GenieScreen(),
),
);
},
),
GenieGroceryCardView(
title: 'Grocery',
subtitle: 'Esentials delivered\nin 2 Hrs',
image: 'assets/images/food4.jpg',
onTap: isTabletDesktop
? () {}
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const GenieScreen(),
),
);
},
),
GenieGroceryCardView(
title: 'Meat',
subtitle: 'Fesh meat\ndelivered safe',
image: 'assets/images/food6.jpg',
onTap: isTabletDesktop
? () {}
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MeatScreen(),
),
);
},
),
],
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/restaurants/restaurant_detail_screen.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/restaurant_detail.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/custom_divider_view.dart';
import 'package:swiggy_ui/widgets/veg_badge_view.dart';
class RestaurantDetailScreen extends StatelessWidget {
const RestaurantDetailScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
iconTheme: const IconThemeData(color: Colors.black),
elevation: 0.0,
actions: <Widget>[
const Icon(Icons.favorite_border),
UIHelper.horizontalSpaceSmall(),
const Icon(Icons.search),
UIHelper.horizontalSpaceSmall(),
],
),
body: _OrderNowView(),
);
}
}
class _OrderNowView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Namma Veedu Vasanta Bhavan',
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontWeight: FontWeight.bold, fontSize: 16.0),
),
UIHelper.verticalSpaceSmall(),
Text('South Indian',
style: Theme.of(context).textTheme.bodyText1),
UIHelper.verticalSpaceExtraSmall(),
Text('Velachery Main Road, Madipakkam',
style: Theme.of(context).textTheme.bodyText1),
UIHelper.verticalSpaceMedium(),
const CustomDividerView(dividerHeight: 1.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
_buildVerticalStack(context, '4.1', 'Packaging 80%'),
_buildVerticalStack(context, '29 mins', 'Delivery Time'),
_buildVerticalStack(context, 'Rs150', 'For Two'),
],
),
const CustomDividerView(dividerHeight: 1.0),
UIHelper.verticalSpaceMedium(),
Column(
children: <Widget>[
_buildOfferTile(
context, '30% off up to Rs75 | Use code SWIGGYIT'),
_buildOfferTile(context,
'20% off up to Rs100 with SBI credit cards, once per week | Use code 100SBI')
],
),
UIHelper.verticalSpaceSmall(),
],
),
),
const CustomDividerView(dividerHeight: 15.0),
Container(
height: 80.0,
padding: const EdgeInsets.all(10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Icon(
Icons.filter_vintage,
color: Colors.green,
size: 12.0,
),
UIHelper.horizontalSpaceExtraSmall(),
Text('PURE VEG',
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(
fontWeight: FontWeight.bold, fontSize: 16.0))
],
),
),
const CustomDividerView(dividerHeight: 0.5, color: Colors.black)
],
),
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
'Recommended',
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 18.0),
),
),
_RecommendedFoodView(),
const CustomDividerView(dividerHeight: 15.0),
_FoodListView(
title: 'Breakfast',
foods: RestaurantDetail.getBreakfast(),
),
const CustomDividerView(dividerHeight: 15.0),
_FoodListView(
title: 'All Time Favourite',
foods: RestaurantDetail.getAllTimeFavFoods(),
),
const CustomDividerView(dividerHeight: 15.0),
_FoodListView(
title: 'Kozhukattaiyum & Paniyarams',
foods: RestaurantDetail.getOtherDishes(),
)
],
),
);
}
Padding _buildOfferTile(BuildContext context, String desc) => Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: Row(
children: <Widget>[
Icon(Icons.local_offer, color: Colors.red[600], size: 15.0),
UIHelper.horizontalSpaceSmall(),
Flexible(
child: Text(
desc,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 13.0),
),
)
],
),
);
Expanded _buildVerticalStack(
BuildContext context, String title, String subtitle) =>
Expanded(
child: SizedBox(
height: 60.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
title,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 15.0),
),
UIHelper.verticalSpaceExtraSmall(),
Text(subtitle,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 13.0))
],
),
),
);
}
class _RecommendedFoodView extends StatelessWidget {
final foods = RestaurantDetail.getBreakfast();
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(10.0),
child: GridView.count(
shrinkWrap: true,
crossAxisCount: 2,
childAspectRatio: 0.8,
physics: const NeverScrollableScrollPhysics(),
children: List.generate(
foods.length,
(index) => Container(
margin: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: Image.asset(
foods[index].image,
fit: BoxFit.fill,
),
),
UIHelper.verticalSpaceExtraSmall(),
SizedBox(
height: 80.0,
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'BREAKFAST',
style: Theme.of(context).textTheme.bodyText1!.copyWith(
fontSize: 10.0,
color: Colors.grey[700],
),
),
UIHelper.verticalSpaceExtraSmall(),
Row(
children: <Widget>[
const VegBadgeView(),
UIHelper.horizontalSpaceExtraSmall(),
Flexible(
child: Text(
foods[index].title,
maxLines: 1,
style:
const TextStyle(fontWeight: FontWeight.bold),
),
),
],
),
UIHelper.verticalSpaceMedium(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(foods[index].price,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 14.0)),
const AddBtnView()
],
)
],
),
)
],
),
),
),
),
);
}
}
class AddBtnView extends StatelessWidget {
const AddBtnView({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 6.0, horizontal: 25.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
),
child: Text(
'ADD',
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(color: Colors.green),
),
);
}
}
class _FoodListView extends StatelessWidget {
const _FoodListView({
Key? key,
required this.title,
required this.foods,
}) : super(key: key);
final String title;
final List<RestaurantDetail> foods;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
UIHelper.verticalSpaceMedium(),
Text(
title,
style:
Theme.of(context).textTheme.subtitle2!.copyWith(fontSize: 18.0),
),
ListView.builder(
shrinkWrap: true,
itemCount: foods.length,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => Container(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
UIHelper.verticalSpaceSmall(),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const VegBadgeView(),
UIHelper.horizontalSpaceMedium(),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text(
foods[index].title,
style: Theme.of(context).textTheme.bodyText1,
),
UIHelper.verticalSpaceSmall(),
Text(
foods[index].price,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 14.0),
),
UIHelper.verticalSpaceMedium(),
Text(
foods[index].desc,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(
fontSize: 12.0,
color: Colors.grey[500],
),
),
],
),
),
const AddBtnView()
],
),
],
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/restaurants/restaurant_vertical_list_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/mobile/food_list_item_view.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
import 'restaurant_detail_screen.dart';
class RestaurantVerticalListView extends StatelessWidget {
final String title;
final List<SpotlightBestTopFood> restaurants;
final bool isAllRestaurantNearby;
const RestaurantVerticalListView({
Key? key,
required this.title,
required this.restaurants,
this.isAllRestaurantNearby = false,
}) : assert(title != ''),
super(key: key);
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
return Container(
margin: const EdgeInsets.all(10.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style:
Theme.of(context).textTheme.headline4!.copyWith(fontSize: 20.0),
),
isAllRestaurantNearby
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
UIHelper.verticalSpaceExtraSmall(),
Text(
'Discover unique tastes near you',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 14.0),
),
],
)
: const SizedBox(),
UIHelper.verticalSpaceMedium(),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: restaurants.length,
itemBuilder: (context, index) => InkWell(
onTap: isTabletDesktop
? () {}
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const RestaurantDetailScreen(),
),
);
},
child: FoodListItemView(
restaurant: restaurants[index],
),
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/meat/meat_screen.dart | import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/custom_divider_view.dart';
class MeatScreen extends StatelessWidget {
const MeatScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
_buildAppBar(context),
_SearchView(),
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
_MeatOfferBannerView(),
_CardView(),
_StoresListView(
title: 'Nearby stores',
desc: 'Trusted for best buying experience',
),
const CustomDividerView(dividerHeight: 15.0),
_StoresListView(
title: 'Faraway stores',
desc: 'Additional distance fee applicable',
)
],
),
),
)
],
),
),
);
}
Container _buildAppBar(BuildContext context) => Container(
height: 80.0,
padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => Navigator.pop(context)),
UIHelper.horizontalSpaceSmall(),
Container(
height: 32.0,
width: 32.0,
decoration: BoxDecoration(
border: Border.all(width: 1.0),
borderRadius: BorderRadius.circular(16.2),
),
child: const Icon(
Icons.location_on,
color: Colors.orange,
size: 25.0,
),
),
UIHelper.horizontalSpaceSmall(),
Text(
'Fresh Meat Stores',
style: Theme.of(context).textTheme.headline6,
)
],
),
);
}
class _SearchView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.center,
children: <Widget>[
const CustomDividerView(dividerHeight: 3.0),
Container(
padding: const EdgeInsets.only(left: 15.0, top: 2.0, bottom: 2.0),
margin: const EdgeInsets.symmetric(horizontal: 15.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[400]!),
borderRadius: BorderRadius.circular(2.0),
color: Colors.white,
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey[200]!,
blurRadius: 3.0,
spreadRadius: 5.0,
)
],
),
child: Row(
children: <Widget>[
Expanded(
child: TextField(
decoration: InputDecoration(
hintText: 'Search for restaurants and food',
hintStyle: Theme.of(context).textTheme.subtitle2!.copyWith(
color: Colors.grey,
fontSize: 17.0,
fontWeight: FontWeight.w600,
),
border: InputBorder.none,
),
),
),
UIHelper.horizontalSpaceMedium(),
IconButton(
icon: const Icon(Icons.search),
onPressed: () {},
)
],
),
),
],
);
}
}
class _MeatOfferBannerView extends StatelessWidget {
final List<String> images = [
'assets/images/banner1.jpg',
'assets/images/banner2.jpg',
'assets/images/banner3.jpg',
'assets/images/banner4.jpg',
];
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(15.0),
height: 180.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
),
child: Swiper(
itemHeight: 100,
duration: 500,
itemWidth: double.infinity,
pagination: const SwiperPagination(),
itemCount: images.length,
itemBuilder: (BuildContext context, int index) => Image.asset(
images[index],
fit: BoxFit.cover,
),
autoplay: true,
viewportFraction: 1.0,
scale: 0.9,
),
);
}
}
class _CardView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 15.0),
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.orange[100],
border: Border.all(color: swiggyOrange!, width: 2.0),
borderRadius: BorderRadius.circular(10.0),
),
child: Row(
children: <Widget>[
Flexible(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'No-contact Delivery',
style: Theme.of(context).textTheme.headline6,
),
UIHelper.verticalSpaceExtraSmall(),
Text(
'Have your order dropped of at your door or gate for added safety',
style: Theme.of(context).textTheme.bodyText1,
),
],
),
),
UIHelper.verticalSpaceExtraSmall(),
TextButton(
child: Text(
'Know More',
style: Theme.of(context)
.textTheme
.headline6!
.copyWith(color: darkOrange),
),
onPressed: () {},
)
],
),
),
UIHelper.horizontalSpaceSmall(),
ClipOval(
child: Image.asset(
'assets/images/food3.jpg',
height: 90.0,
width: 90.0,
),
)
],
),
);
}
}
class _StoresListView extends StatelessWidget {
final String title;
final String desc;
final foods = SpotlightBestTopFood.getPopularAllRestaurants();
_StoresListView({
Key? key,
required this.title,
required this.desc,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(15.0),
child: _ListViewHeader(
title: title,
desc: desc,
),
),
ListView.builder(
shrinkWrap: true,
itemCount: foods.length,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => Container(
margin: const EdgeInsets.all(15.0),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Container(
decoration: const BoxDecoration(
color: Colors.white,
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey,
blurRadius: 2.0,
)
],
),
child: Image.asset(
foods[index].image,
height: 80.0,
width: 80.0,
fit: BoxFit.fill,
),
),
),
UIHelper.horizontalSpaceSmall(),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
foods[index].name,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 16.0),
),
Text(foods[index].desc,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey[800], fontSize: 13.5)),
UIHelper.verticalSpaceSmall(),
Text(
foods[index].coupon,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.red[900], fontSize: 13.0),
),
const Divider(),
Row(
children: <Widget>[
Icon(
Icons.fastfood,
size: 14.0,
color: Colors.green[400],
),
UIHelper.horizontalSpaceSmall(),
const Text('200+ Items available')
],
)
],
)
],
),
),
)
],
);
}
}
class _ListViewHeader extends StatelessWidget {
final String title;
final String desc;
const _ListViewHeader({
Key? key,
required this.title,
required this.desc,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Icon(
Icons.check_circle_outline,
color: Colors.blue[300],
),
UIHelper.horizontalSpaceSmall(),
Text(
title,
style: Theme.of(context).textTheme.subtitle2!.copyWith(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
],
),
UIHelper.verticalSpaceExtraSmall(),
Text(desc)
],
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/all_restaurants/all_restaurants_screen.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/all_restaurant.dart';
import 'package:swiggy_ui/models/indian_food.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/custom_divider_view.dart';
import 'package:swiggy_ui/widgets/mobile/search_food_list_item_view.dart';
import '../groceries/grocery_screen.dart';
import '../indian_food/indian_delight_screen.dart';
import '../offers/offer_screen.dart';
class AllRestaurantsScreen extends StatelessWidget {
final restaurantListOne = AllRestaurant.getRestaurantListOne();
final restaurantListTwo = AllRestaurant.getRestaurantListTwo();
final restaurantListThree = AllRestaurant.getRestaurantListThree();
AllRestaurantsScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
_buildAppBar(context),
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_FoodHorizontalListView(),
_CategoriesView(),
const GroceryListView(
title: 'ALL RESTAURANTS',
),
_RestaurantHorizontalListView(
title: 'Indian Restaurants',
restaurants: AllRestaurant.getIndianRestaurants(),
),
_RestaurantListView(
restaurants: restaurantListOne,
),
_RestaurantHorizontalListView(
title: 'Popular Brands',
restaurants: AllRestaurant.getPopularBrands(),
),
_RestaurantListView(
restaurants: restaurantListTwo,
),
_LargeRestaurantBannerView(
title: 'BEST IN SAFETY',
desc:
'SAFEST RESTAURANTS WITH BEST IN CLASS\nSAFETY STANDARDS',
restaurants:
LargeRestaurantBanner.getBestInSafetyRestaurants(),
),
_RestaurantListView(
restaurants: restaurantListOne,
),
_LargeRestaurantBannerView(
title: 'PEPSI SAVE OUR RESTAURANTS',
desc:
'ORDER ANY SOFT DRINK & PEPSI WILL DONATE A\nMEAL TO A RESTAURANT WORKER',
restaurants:
LargeRestaurantBanner.getPepsiSaveOurRestaurants(),
),
_RestaurantListView(
restaurants: restaurantListThree,
),
_RestaurantHorizontalListView(
title: 'Popular Brands',
restaurants: AllRestaurant.getPopularBrands(),
),
_RestaurantListView(
restaurants: restaurantListOne,
),
],
),
),
)
],
),
),
);
}
Container _buildAppBar(BuildContext context) => Container(
margin: const EdgeInsets.only(left: 5.0, right: 15.0),
height: 60.0,
child: Row(
children: <Widget>[
IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
UIHelper.horizontalSpaceSmall(),
Text(
'Now',
style: Theme.of(context).textTheme.subtitle2!.copyWith(
fontSize: 18.0,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
),
UIHelper.horizontalSpaceSmall(),
Container(
alignment: Alignment.center,
height: 25.0,
width: 25.0,
decoration: BoxDecoration(
border: Border.all(width: 1.3),
borderRadius: BorderRadius.circular(15.0),
),
child: const Icon(Icons.arrow_forward_ios, size: 13.0),
),
UIHelper.horizontalSpaceSmall(),
Text(
'Other',
style: Theme.of(context)
.textTheme
.headline4!
.copyWith(fontSize: 21.0),
),
UIHelper.horizontalSpaceExtraSmall(),
const Spacer(),
const Icon(Icons.local_offer),
UIHelper.horizontalSpaceExtraSmall(),
InkWell(
child: Container(
padding: const EdgeInsets.all(5.0),
child: Text(
'Offer',
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 18.0),
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const OffersScreen(),
),
);
},
),
],
),
);
}
class _FoodHorizontalListView extends StatelessWidget {
final restaurants = AllRestaurant.getPopularBrands();
@override
Widget build(BuildContext context) {
return SizedBox(
height: MediaQuery.of(context).size.height / 4,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: restaurants.length,
itemBuilder: (context, index) => Padding(
padding: const EdgeInsets.all(10.0),
child: Stack(
children: <Widget>[
Image.asset(
restaurants[index].image,
height: MediaQuery.of(context).size.height / 4,
width: MediaQuery.of(context).size.width / 2,
),
Container(
margin: const EdgeInsets.all(10.0),
padding:
const EdgeInsets.symmetric(vertical: 6.0, horizontal: 10.0),
color: Colors.white,
child: const Text('TRY NOW'),
),
Positioned(
bottom: 1.0,
child: Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric(horizontal: 10.0),
height: 70.0,
color: Colors.black38,
width: MediaQuery.of(context).size.width / 2,
child: Text(
restaurants[index].name,
style: Theme.of(context).textTheme.headline6!.copyWith(
color: Colors.white, fontWeight: FontWeight.bold),
),
),
)
],
),
),
),
);
}
}
class _CategoriesView extends StatelessWidget {
final categories = AllRestaurant.getPopularTypes();
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
height: 115.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: categories.length,
itemBuilder: (context, index) => Container(
margin:
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
width: 60.0,
child: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(5.0),
child: Container(
height: 40.0,
color: Colors.grey[200],
),
),
Positioned(
top: 20.0,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset(
categories[index].image,
height: 30.0,
width: 30.0,
fit: BoxFit.cover,
),
UIHelper.verticalSpaceSmall(),
Flexible(
child: Text(
categories[index].name,
maxLines: 2,
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 13.0),
),
)
],
),
),
],
)),
),
);
}
}
class _RestaurantHorizontalListView extends StatelessWidget {
final String title;
final List<IndianFood> restaurants;
const _RestaurantHorizontalListView({
Key? key,
required this.title,
required this.restaurants,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(15.0),
height: 180.0,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const CustomDividerView(dividerHeight: 1.0, color: Colors.black),
UIHelper.verticalSpaceSmall(),
Text(
title,
style:
Theme.of(context).textTheme.subtitle2!.copyWith(fontSize: 18.0),
),
UIHelper.verticalSpaceSmall(),
Flexible(
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: restaurants.length,
itemBuilder: (context, index) => InkWell(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 12.0),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ClipOval(
child: Image.asset(
restaurants[index].image,
height: 80.0,
width: 80.0,
fit: BoxFit.cover,
),
),
UIHelper.verticalSpaceExtraSmall(),
Text(
restaurants[index].name,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(color: Colors.grey[700]),
)
],
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const IndianDelightScreen(),
),
);
},
),
),
),
UIHelper.verticalSpaceSmall(),
const CustomDividerView(dividerHeight: 1.0, color: Colors.black),
],
),
);
}
}
class _RestaurantListView extends StatelessWidget {
const _RestaurantListView({
Key? key,
required this.restaurants,
}) : super(key: key);
final List<SpotlightBestTopFood> restaurants;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(15.0),
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: restaurants.length,
itemBuilder: (context, index) => SearchFoodListItemView(
food: restaurants[index],
),
),
);
}
}
class _LargeRestaurantBannerView extends StatelessWidget {
const _LargeRestaurantBannerView({
Key? key,
required this.title,
required this.desc,
required this.restaurants,
}) : super(key: key);
final String title;
final String desc;
final List<LargeRestaurantBanner> restaurants;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 10.0),
color: Colors.blueGrey[50],
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
UIHelper.verticalSpaceMedium(),
Text(
title,
style:
Theme.of(context).textTheme.subtitle2!.copyWith(fontSize: 18.0),
),
UIHelper.verticalSpaceSmall(),
Text(
desc,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyText1!.copyWith(
color: Colors.grey,
fontSize: 12.0,
),
),
UIHelper.verticalSpaceSmall(),
LimitedBox(
maxHeight: 310.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: restaurants.length,
itemBuilder: (context, index) => Container(
padding: const EdgeInsets.all(10.0),
width: 160.0,
child: Column(
children: <Widget>[
UIHelper.verticalSpaceMedium(),
Image.asset(
restaurants[index].image,
height: 160.0,
fit: BoxFit.cover,
),
UIHelper.verticalSpaceMedium(),
Text(
restaurants[index].title,
maxLines: 2,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle2!.copyWith(
fontWeight: FontWeight.bold,
fontSize: 13.0,
),
),
UIHelper.verticalSpaceMedium(),
Container(
height: 2.0,
width: 50.0,
color: Colors.grey[400],
),
UIHelper.verticalSpaceSmall(),
Text(
restaurants[index].subtitle,
maxLines: 2,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyText1,
),
],
),
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/genie/genie_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/dotted_seperator_view.dart';
class GenieView extends StatelessWidget {
const GenieView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Genie', style: Theme.of(context).textTheme.headline4),
UIHelper.verticalSpaceSmall(),
Text(
'Anything you need, deliverd.\nPick-up, Drop or Buy anything,\nfrom anywhere in your city',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey),
)
],
),
),
UIHelper.horizontalSpaceMedium(),
LimitedBox(
maxWidth: 100.0,
child: Image.asset(
'assets/images/delivery-man.png',
fit: BoxFit.cover,
),
),
],
),
UIHelper.verticalSpaceMedium(),
const DottedSeperatorView(),
UIHelper.verticalSpaceMedium(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: const <Widget>[
_GenieCardView(
title: 'Buy\nAnything',
desc: 'Stationery\nMedicine\nGrocery\n& more',
image: 'assets/images/delivery-boy.png',
),
_GenieCardView(
title: 'Pickup &\nDrop',
desc: 'Lunchbox\nCharger\nDocuments\nClothes',
image: 'assets/images/pizza-delivery-boy.png',
)
],
)
],
),
);
}
}
class _GenieCardView extends StatelessWidget {
const _GenieCardView({
Key? key,
required this.title,
required this.desc,
required this.image,
this.onTap,
}) : super(key: key);
final String title;
final String desc;
final String image;
final VoidCallback? onTap;
@override
Widget build(BuildContext context) {
return Expanded(
child: InkWell(
onTap: onTap,
child: Container(
padding: const EdgeInsets.only(left: 10.0, top: 10.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(10.0),
color: Colors.white,
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey[200]!,
blurRadius: 2.0,
offset: const Offset(1.0, 3.0),
)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 22.0),
),
UIHelper.verticalSpaceMedium(),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
desc,
style: Theme.of(context).textTheme.bodyText1,
),
UIHelper.verticalSpaceSmall(),
ClipOval(
child: Container(
alignment: Alignment.center,
color: swiggyOrange,
height: 25.0,
width: 25.0,
child: const Icon(
Icons.arrow_forward_ios,
size: 12.0,
color: Colors.white,
),
),
),
UIHelper.verticalSpaceMedium(),
],
),
UIHelper.horizontalSpaceMedium(),
Flexible(
child: Image.asset(
image,
fit: BoxFit.contain,
),
),
UIHelper.horizontalSpaceExtraSmall(),
],
)
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/genie/genie_screen.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/genie.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/custom_divider_view.dart';
class GenieScreen extends StatelessWidget {
const GenieScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final services = Genie.getGenieServices();
return Scaffold(
body: SafeArea(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 10.0),
color: Colors.indigo,
height: MediaQuery.of(context).size.height,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () {
Navigator.pop(context);
},
),
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
UIHelper.verticalSpaceMedium(),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Genie',
style: Theme.of(context)
.textTheme
.headline4!
.copyWith(color: Colors.white),
),
UIHelper.horizontalSpaceSmall(),
Image.asset(
'assets/images/delivery-boy.png',
height: 50.0,
width: 50.0,
)
],
),
UIHelper.verticalSpaceExtraSmall(),
Text(
'Anything you need, delivered',
style:
Theme.of(context).textTheme.bodyText1!.copyWith(
color: Colors.grey[200],
fontSize: 17.0,
),
)
],
),
UIHelper.verticalSpaceMedium(),
Container(
padding: const EdgeInsets.all(20.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.0),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const _HeaderView(
title: 'Pickup or Drop any items',
buttonTitle: 'ADD PICKUP DROP DETAILS',
),
const CustomDividerView(dividerHeight: 3.0),
UIHelper.verticalSpaceMedium(),
Text(
'Some things we can pick or drop for you',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 14.0),
),
UIHelper.verticalSpaceMedium(),
LimitedBox(
maxHeight: 100.0,
child: ListView.builder(
itemCount: services.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) => SizedBox(
width: 80.0,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ClipOval(
child: Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.grey[200],
boxShadow: const <BoxShadow>[
BoxShadow(
color: Colors.grey,
blurRadius: 3.0,
spreadRadius: 2.0,
)
],
),
child: Image.asset(
services[index].image,
height: 30.0,
width: 30.0,
// fit: BoxFit.contain,
),
),
),
Text(
services[index].title,
textAlign: TextAlign.center,
maxLines: 2,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 13.5),
)
],
),
),
),
)
],
),
),
UIHelper.verticalSpaceMedium(),
Container(
padding: const EdgeInsets.all(20.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.0),
),
child: const _HeaderView(
title: 'Buy Anything from any store',
buttonTitle: 'FIND A STORE',
),
),
],
),
),
)
],
),
),
),
);
}
}
class _HeaderView extends StatelessWidget {
final String title;
final String buttonTitle;
const _HeaderView({
Key? key,
required this.title,
required this.buttonTitle,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: Theme.of(context).textTheme.headline6!.copyWith(
fontSize: 17.0,
fontWeight: FontWeight.bold,
),
),
UIHelper.verticalSpaceMedium(),
Container(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
height: 50.0,
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(primary: darkOrange),
child: Text(
buttonTitle,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(color: Colors.white, fontSize: 14.0),
),
onPressed: () {},
),
),
UIHelper.verticalSpaceMedium(),
],
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/genie/genie_grocery_card_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
class GenieGroceryCardView extends StatelessWidget {
const GenieGroceryCardView({
Key? key,
required this.title,
required this.image,
required this.subtitle,
this.onTap,
}) : super(key: key);
final String title;
final String image;
final String subtitle;
final VoidCallback? onTap;
@override
Widget build(BuildContext context) {
return Expanded(
child: InkWell(
onTap: onTap,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(16.0),
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 4.0),
padding: const EdgeInsets.only(top: 8.0),
height: 120.0,
decoration: BoxDecoration(
color: swiggyOrange,
boxShadow: const <BoxShadow>[
BoxShadow(
color: Colors.grey,
blurRadius: 3.0,
offset: Offset(1, 4),
)
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
title,
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.headline4!
.copyWith(fontSize: 18.0, color: Colors.white),
),
UIHelper.verticalSpaceSmall(),
Expanded(
child: Image.asset(
image,
fit: BoxFit.cover,
),
)
],
),
),
),
UIHelper.verticalSpaceMedium(),
Text(
subtitle,
maxLines: 2,
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 16.0),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/groceries/grocery_screen.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/mobile/search_food_list_item_view.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
class GroceryScreen extends StatelessWidget {
const GroceryScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const _GroceryHeaderView(),
UIHelper.verticalSpaceMedium(),
const GroceryListView(
title: '156 RESTAURANTS NEARBY',
),
],
),
),
);
}
}
class _GroceryHeaderView extends StatelessWidget {
const _GroceryHeaderView({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
return Stack(
children: <Widget>[
Image.asset(
'assets/images/banner3.jpg',
height: MediaQuery.of(context).size.height / 2.1,
width: double.infinity,
fit: BoxFit.cover,
),
if (!isTabletDesktop)
Positioned(
top: 40.0,
left: 0.4,
child: IconButton(
icon: const Icon(
Icons.arrow_back,
size: 28.0,
color: Colors.white,
),
onPressed: () {
Navigator.pop(context);
},
),
)
],
);
}
}
class GroceryListView extends StatelessWidget {
const GroceryListView({
Key? key,
required this.title,
}) : super(key: key);
final String title;
@override
Widget build(BuildContext context) {
final restaurants = SpotlightBestTopFood.getTopGroceryRestaurants();
final headerStyle = Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontWeight: FontWeight.w500, fontSize: 13.0);
return Container(
padding: const EdgeInsets.all(15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
title,
style: headerStyle,
),
const Spacer(),
const Icon(Icons.filter_list),
UIHelper.horizontalSpaceSmall(),
Text('SORT/FILTER', style: headerStyle)
],
),
UIHelper.verticalSpaceSmall(),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: restaurants.length,
itemBuilder: (context, index) => SearchFoodListItemView(
food: restaurants[index],
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/indian_food/indian_delight_screen.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import '../groceries/grocery_screen.dart';
class IndianDelightScreen extends StatelessWidget {
const IndianDelightScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Positioned.fill(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset(
'assets/images/banner3.jpg',
height: MediaQuery.of(context).size.height / 5.0,
width: double.infinity,
fit: BoxFit.cover,
),
UIHelper.verticalSpaceMedium(),
Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'SOUTH INDIAN DELIGHTS',
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 19.0),
),
UIHelper.verticalSpaceSmall(),
const Text(
'Feast on authentic South Indian fare from top restaurants near you',
),
UIHelper.verticalSpaceSmall(),
const Divider(),
],
),
),
const GroceryListView(
title: 'SEE ALL RESTAURANTS',
),
],
),
),
),
Positioned(
top: 10.0,
left: 2.4,
child: SafeArea(
child: IconButton(
icon: const Icon(
Icons.arrow_back,
size: 28.0,
color: Colors.white,
),
onPressed: () {
Navigator.pop(context);
},
),
),
),
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/indian_food/indian_food_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/indian_food.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'indian_delight_screen.dart';
class IndianFoodView extends StatelessWidget {
final restaurants = IndianFood.getIndianRestaurants();
IndianFoodView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(15.0),
height: 150.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: restaurants.length,
itemBuilder: (context, index) => InkWell(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 12.0),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ClipOval(
child: Image.asset(
restaurants[index].image,
height: 80.0,
width: 80.0,
fit: BoxFit.cover,
),
),
UIHelper.verticalSpaceExtraSmall(),
Text(
restaurants[index].name,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(color: Colors.grey[700]),
)
],
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const IndianDelightScreen(),
),
);
},
),
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/offers/offer_screen.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/available_coupon.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/custom_divider_view.dart';
import 'package:swiggy_ui/widgets/mobile/food_list_item_view.dart';
import '../restaurants/restaurant_detail_screen.dart';
class OffersScreen extends StatelessWidget {
const OffersScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
iconTheme: const IconThemeData(color: Colors.black),
title: Text(
'OFFERS',
style:
Theme.of(context).textTheme.subtitle2!.copyWith(fontSize: 17.0),
),
bottom: const TabBar(
indicatorColor: Colors.black,
tabs: <Widget>[
Tab(child: Text('RESTAURANT OFFERS')),
Tab(child: Text('PAYMENT OFFERS/COUPONS')),
],
),
),
body: TabBarView(
children: [
_RestaurantOfferView(),
_PaymentOffersCouponView(),
],
),
),
);
}
}
class _RestaurantOfferView extends StatelessWidget {
final foods = [
...SpotlightBestTopFood.getPopularAllRestaurants(),
...SpotlightBestTopFood.getPopularAllRestaurants(),
...SpotlightBestTopFood.getPopularAllRestaurants()
];
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
UIHelper.verticalSpaceSmall(),
Text(
'All Offers (${foods.length})',
style: Theme.of(context)
.textTheme
.headline6!
.copyWith(fontWeight: FontWeight.bold, fontSize: 19.0),
),
UIHelper.verticalSpaceMedium(),
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: foods.length,
itemBuilder: (context, index) => Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const RestaurantDetailScreen(),
),
);
},
child: FoodListItemView(
restaurant: foods[index],
),
),
),
),
)
],
),
);
}
}
class _PaymentOffersCouponView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final coupons = AvailableCoupon.getAvailableCoupons();
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.only(left: 15.0),
height: 40.0,
color: Colors.grey[200],
child: Text('Available Coupons',
style: Theme.of(context).textTheme.subtitle2),
),
Expanded(
child: ListView.separated(
shrinkWrap: true,
itemCount: coupons.length,
separatorBuilder: (context, index) => const Divider(),
itemBuilder: (context, index) => Container(
margin: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.orange[100],
border: Border.all(color: Colors.grey[400]!),
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Image.asset(
'assets/images/food1.jpg',
height: 10.0,
width: 10.0,
fit: BoxFit.cover,
),
UIHelper.horizontalSpaceMedium(),
Text(coupons[index].coupon,
style: Theme.of(context).textTheme.subtitle2)
],
),
),
UIHelper.verticalSpaceSmall(),
Text(
coupons[index].discount,
style: Theme.of(context).textTheme.subtitle2,
),
UIHelper.verticalSpaceMedium(),
const CustomDividerView(
dividerHeight: 1.0,
color: Colors.grey,
),
UIHelper.verticalSpaceMedium(),
Text(
coupons[index].desc,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: 13.0),
),
UIHelper.verticalSpaceMedium(),
InkWell(
child: Text(
'+ MORE',
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(color: Colors.blue),
),
)
],
),
),
),
)
],
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy | mirrored_repositories/SwiggyUI/lib/views/mobile/swiggy/offers/offer_banner_view.dart | import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/material.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
import '../groceries/grocery_screen.dart';
class OfferBannerView extends StatelessWidget {
final List<String> images = [
'assets/images/banner1.jpg',
'assets/images/banner2.jpg',
'assets/images/banner3.jpg',
'assets/images/banner4.jpg',
];
OfferBannerView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
return InkWell(
child: Container(
margin: const EdgeInsets.symmetric(vertical: 15.0),
height: isTabletDesktop ? 260.0 : 180.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(isTabletDesktop ? 13.0 : 10.0),
),
child: Swiper(
itemHeight: 100,
duration: 500,
itemWidth: double.infinity,
pagination: const SwiperPagination(),
itemCount: images.length,
itemBuilder: (BuildContext context, int index) => Image.asset(
images[index],
fit: BoxFit.cover,
),
autoplay: true,
viewportFraction: 1.0,
scale: 0.9,
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const GroceryScreen(),
),
);
},
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views/mobile | mirrored_repositories/SwiggyUI/lib/views/mobile/search/search_screen.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/widgets/custom_divider_view.dart';
import 'package:swiggy_ui/widgets/mobile/search_food_list_item_view.dart';
class SearchScreen extends StatefulWidget {
const SearchScreen({Key? key}) : super(key: key);
@override
_SearchScreenState createState() => _SearchScreenState();
}
class _SearchScreenState extends State<SearchScreen>
with SingleTickerProviderStateMixin {
TabController? _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
}
@override
void dispose() {
super.dispose();
_tabController!.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Container(
padding: const EdgeInsets.all(15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding:
const EdgeInsets.only(left: 15.0, top: 2.0, bottom: 2.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[400]!),
borderRadius: BorderRadius.circular(2.0),
),
child: Row(
children: <Widget>[
Expanded(
child: TextField(
decoration: InputDecoration(
hintText: 'Search for restaurants and food',
hintStyle:
Theme.of(context).textTheme.subtitle2!.copyWith(
color: Colors.grey,
fontSize: 17.0,
fontWeight: FontWeight.w600,
),
border: InputBorder.none,
),
),
),
UIHelper.horizontalSpaceMedium(),
IconButton(
icon: const Icon(Icons.search),
onPressed: () {},
)
],
),
),
UIHelper.verticalSpaceExtraSmall(),
TabBar(
unselectedLabelColor: Colors.grey,
labelColor: Colors.black,
controller: _tabController,
indicatorColor: darkOrange,
labelStyle: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 18.0, color: darkOrange),
unselectedLabelStyle:
Theme.of(context).textTheme.subtitle2!.copyWith(
fontSize: 18.0,
color: Colors.grey[200],
),
indicatorSize: TabBarIndicatorSize.tab,
tabs: const [
Tab(child: Text('Restaurant')),
Tab(child: Text('Dishes')),
],
),
UIHelper.verticalSpaceSmall(),
const CustomDividerView(dividerHeight: 8.0),
Expanded(
child: TabBarView(
controller: _tabController,
children: [
_SearchListView(),
_SearchListView(),
],
),
),
],
),
),
),
);
}
}
class _SearchListView extends StatelessWidget {
final List<SpotlightBestTopFood> foods = [
...SpotlightBestTopFood.getPopularAllRestaurants(),
...SpotlightBestTopFood.getPopularAllRestaurants()
];
@override
Widget build(BuildContext context) {
foods.shuffle();
return ListView.builder(
shrinkWrap: true,
itemCount: foods.length,
itemBuilder: (context, index) => SearchFoodListItemView(
food: foods[index],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views | mirrored_repositories/SwiggyUI/lib/views/tab_desktop/cart_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/tab_desktop/order_menu.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
class CartView extends StatelessWidget {
const CartView({Key? key, this.isTab = false}) : super(key: key);
final bool isTab;
@override
Widget build(BuildContext context) {
return Expanded(
flex: 2,
child: Container(
color: Colors.white,
alignment: Alignment.center,
padding: EdgeInsets.only(
left: isTab ? 20.0 : 40.0,
top: 40.0,
right: isTab ? 20.0 : 40.0,
bottom: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_UserHeader(),
_MyOrdersList(),
_Checkout(),
],
),
),
);
}
}
class _UserHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Expanded(
flex: 1,
child: Container(
alignment: Alignment.centerRight,
padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
alignment: Alignment.topRight,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.0),
color: Colors.grey[100],
),
height: 50.0,
width: 50.0,
child: const Icon(
Icons.notifications_outlined,
),
),
UIHelper.horizontalSpaceMedium(),
ClipOval(
child: Image.asset(
'assets/images/user.jpg',
height: 50.0,
width: 50.0,
fit: BoxFit.fill,
),
),
UIHelper.horizontalSpaceMedium(),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Vinoth',
style: Theme.of(context).textTheme.headline6!.copyWith(
fontSize: 17.0, fontWeight: FontWeight.bold),
),
UIHelper.verticalSpaceExtraSmall(),
Text(
'User',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey, fontSize: 13.0),
),
],
),
UIHelper.horizontalSpaceMedium(),
const Icon(Icons.keyboard_arrow_down_outlined),
],
),
),
],
),
),
);
}
}
class _MyOrdersList extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cartItems = OrderMenu.getCartItems();
return Expanded(
flex: 4,
child: Container(
padding: const EdgeInsets.symmetric(vertical: 15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text('Order Menu',
style: Theme.of(context).textTheme.headline6),
const Spacer(),
Text('See all',
style: Theme.of(context)
.textTheme
.subtitle1!
.copyWith(color: swiggyOrange)),
],
),
UIHelper.verticalSpaceSmall(),
Expanded(
child: ListView(
shrinkWrap: true,
children: List.generate(
cartItems.length,
(index) => Container(
margin: const EdgeInsets.symmetric(
vertical: 5.0, horizontal: 4.0),
padding: const EdgeInsets.symmetric(
vertical: 15.0, horizontal: 10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18.0),
color: Colors.white,
boxShadow: const [
BoxShadow(color: Colors.grey),
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(18.0),
child: Image.asset(
cartItems[index].image,
height: 70.0,
width: 80.0,
fit: BoxFit.fill,
),
),
UIHelper.horizontalSpaceSmall(),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(cartItems[index].title,
style: Theme.of(context)
.textTheme
.headline6!
.copyWith(fontSize: 14.0)),
UIHelper.verticalSpaceMedium(),
Row(
children: [
const Icon(Icons.close, size: 18.0),
UIHelper.horizontalSpaceMedium(),
Container(
padding: const EdgeInsets.symmetric(
vertical: 2.0, horizontal: 10.0),
decoration: BoxDecoration(
border:
Border.all(color: Colors.grey[300]!),
borderRadius: BorderRadius.circular(8.0),
color: Colors.grey[100],
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text('${cartItems[index].quantity}'),
const Icon(
Icons.keyboard_arrow_down_outlined,
),
],
),
),
],
)
],
),
),
Text(
'Rs ${cartItems[index].price}',
style: Theme.of(context)
.textTheme
.headline6!
.copyWith(
fontSize: 16.0, fontWeight: FontWeight.w800),
),
],
),
),
),
),
),
],
),
),
);
}
}
class _Checkout extends StatelessWidget {
@override
Widget build(BuildContext context) {
final listTileStyle = Theme.of(context)
.textTheme
.subtitle1!
.copyWith(fontSize: 14.0, fontWeight: FontWeight.w600);
final amountStyle = Theme.of(context)
.textTheme
.headline6!
.copyWith(fontSize: 15.0, fontWeight: FontWeight.bold);
return Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(),
ListTile(
dense: true,
title: Text('Item Total', style: listTileStyle),
trailing: Text('Rs 235', style: amountStyle),
),
ListTile(
dense: true,
title: Text('Delivery Fee', style: listTileStyle),
trailing: Text('Rs 305', style: amountStyle),
),
Container(
margin: const EdgeInsets.symmetric(vertical: 15.0),
padding:
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
decoration: BoxDecoration(
border: Border.all(color: swiggyOrange!),
color: Colors.deepOrange[50],
),
child: Row(
children: [
const Expanded(child: Text('Find Promotion')),
UIHelper.horizontalSpaceMedium(),
SizedBox(
height: 38.0,
child: ElevatedButton.icon(
onPressed: () {},
icon: const Icon(Icons.countertops_outlined),
label: const Text('Add Coupon'),
style: ElevatedButton.styleFrom(
onPrimary: Colors.white,
primary: swiggyOrange,
elevation: 0.0,
),
),
),
],
),
),
const Divider(),
ListTile(
dense: true,
title: Text('To Pay', style: listTileStyle),
trailing: Text('Rs 540', style: amountStyle),
),
UIHelper.verticalSpaceMedium(),
SizedBox(
height: 45.0,
width: double.infinity,
child: ElevatedButton.icon(
onPressed: () {},
icon: const Icon(Icons.countertops_outlined),
label: const Text('Checkout'),
style: ElevatedButton.styleFrom(
onPrimary: Colors.white,
primary: swiggyOrange,
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views | mirrored_repositories/SwiggyUI/lib/views/tab_desktop/home_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/views/mobile/swiggy/best_in_safety_view.dart';
import 'package:swiggy_ui/views/mobile/swiggy/food_groceries_availability_view.dart';
import 'package:swiggy_ui/views/mobile/swiggy/in_the_spotlight_view.dart';
import 'package:swiggy_ui/views/mobile/swiggy/offers/offer_banner_view.dart';
import 'package:swiggy_ui/views/mobile/swiggy/popular_brand_view.dart';
import 'package:swiggy_ui/views/mobile/swiggy/popular_categories_view.dart';
import 'package:swiggy_ui/views/mobile/swiggy/restaurants/restaurant_vertical_list_view.dart';
import 'package:swiggy_ui/views/mobile/swiggy/swiggy_safety_banner_view.dart';
import 'package:swiggy_ui/views/mobile/swiggy/swiggy_screen.dart';
import 'package:swiggy_ui/views/mobile/swiggy/top_offer_view.dart';
import 'package:swiggy_ui/widgets/custom_divider_view.dart';
class HomeView extends StatelessWidget {
const HomeView({Key? key, this.expandFlex = 4}) : super(key: key);
final int expandFlex;
@override
Widget build(BuildContext context) {
return Expanded(
flex: expandFlex,
child: Container(
padding: const EdgeInsets.only(top: 40.0, bottom: 20.0),
color: Colors.grey[50],
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_Search(),
_Body(),
],
),
),
);
}
}
class _Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
OfferBannerView(),
PopularBrandsView(),
const CustomDividerView(),
InTheSpotlightView(),
const CustomDividerView(),
PopularCategoriesView(),
const CustomDividerView(),
const SwiggySafetyBannerView(),
BestInSafetyViews(),
const CustomDividerView(),
TopOffersViews(),
const CustomDividerView(),
const FoodGroceriesAvailabilityView(),
const CustomDividerView(),
RestaurantVerticalListView(
title: 'Popular Restaurants',
restaurants: SpotlightBestTopFood.getPopularAllRestaurants(),
),
const CustomDividerView(),
RestaurantVerticalListView(
title: 'All Restaurants Nearby',
restaurants: SpotlightBestTopFood.getPopularAllRestaurants(),
isAllRestaurantNearby: true,
),
const SeeAllRestaurantBtn(),
const LiveForFoodView()
],
),
),
);
}
}
class _Search extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 20.0, horizontal: 40.0),
padding: const EdgeInsets.symmetric(vertical: 17.0, horizontal: 20.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(13.0),
boxShadow: [
BoxShadow(
color: Colors.grey[300]!,
blurRadius: 2.0,
spreadRadius: 0.0,
offset: const Offset(2.0, 2.0),
)
],
),
child: Row(
children: [
const Icon(Icons.search_outlined),
UIHelper.horizontalSpaceMedium(),
Expanded(
child: Text(
'What would you like to eat?',
style: Theme.of(context).textTheme.subtitle1!.copyWith(
color: Colors.grey[700],
fontWeight: FontWeight.bold,
),
),
),
UIHelper.horizontalSpaceMedium(),
const Icon(Icons.filter_list_outlined)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views | mirrored_repositories/SwiggyUI/lib/views/tab_desktop/tab_screen.dart | import 'package:flutter/material.dart';
import 'home_view.dart';
import 'menu_view.dart';
class TabScreen extends StatelessWidget {
const TabScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
MenuView(isTab: true, expandFlex: 1),
HomeView(expandFlex: 5),
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views | mirrored_repositories/SwiggyUI/lib/views/tab_desktop/menu_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/tab_desktop/menu.dart';
import 'package:swiggy_ui/utils/app_colors.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
class MenuView extends StatelessWidget {
const MenuView({Key? key, this.expandFlex = 2, this.isTab = false})
: super(key: key);
final int expandFlex;
final bool isTab;
@override
Widget build(BuildContext context) {
final menus = Menu.getMenus();
return Expanded(
flex: expandFlex,
child: Container(
color: Colors.white,
alignment: Alignment.center,
padding: EdgeInsets.only(
left: isTab ? 20.0 : 40.0,
top: 40.0,
right: isTab ? 20.0 : 40.0,
bottom: 20.0),
child: Column(
children: [
ListView(
shrinkWrap: true,
children: List.generate(
menus.length,
(index) => _MenuItem(
menu: menus[index],
isTab: isTab,
),
),
),
const Spacer(),
isTab
? IconButton(
icon: const Icon(Icons.exit_to_app),
iconSize: 30.0,
onPressed: () {},
)
: FractionallySizedBox(
widthFactor: 0.5,
child: SizedBox(
height: 52.0,
child: OutlinedButton.icon(
icon: const Icon(Icons.exit_to_app),
label: const Text('Logout'),
onPressed: () {},
style: ElevatedButton.styleFrom(
onPrimary: swiggyOrange,
side: BorderSide(width: 2.0, color: swiggyOrange!),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
),
)
],
),
),
);
}
}
class _MenuItem extends StatefulWidget {
const _MenuItem({Key? key, required this.menu, this.isTab = false})
: super(key: key);
final Menu menu;
final bool isTab;
@override
__MenuItemState createState() => __MenuItemState();
}
class __MenuItemState extends State<_MenuItem> {
bool isHovered = false;
bool get isTab => widget.isTab;
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
margin:
isTab ? EdgeInsets.zero : const EdgeInsets.symmetric(vertical: 5.0),
padding:
EdgeInsets.symmetric(vertical: 5.0, horizontal: isTab ? 0.0 : 10.0),
child: InkWell(
onTap: () {},
onHover: (value) {
if (!isTab) {
setState(() {
isHovered = value;
});
}
},
child: Container(
decoration: isHovered
? BoxDecoration(
color: Colors.deepOrange[100],
borderRadius: BorderRadius.circular(30.0),
)
: null,
padding: isTab
? const EdgeInsets.symmetric(vertical: 10.0)
: const EdgeInsets.only(
left: 15.0, top: 10.0, right: 25.0, bottom: 10.0),
child: isTab
? IconButton(
icon: Icon(widget.menu.icon,
color: isHovered ? swiggyOrange : Colors.black),
iconSize: 30.0,
onPressed: () {},
)
: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(widget.menu.icon,
color: isHovered ? swiggyOrange : Colors.black,
size: 30.0),
UIHelper.horizontalSpaceMedium(),
Text(
widget.menu.title,
style: Theme.of(context).textTheme.headline6!.copyWith(
color: isHovered ? swiggyOrange : Colors.black,
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/views | mirrored_repositories/SwiggyUI/lib/views/tab_desktop/desktop_screen.dart | import 'package:flutter/material.dart';
import 'cart_view.dart';
import 'home_view.dart';
import 'menu_view.dart';
class DesktopScreen extends StatelessWidget {
const DesktopScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
MenuView(),
HomeView(),
CartView(),
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/widgets/custom_divider_view.dart | import 'package:flutter/material.dart';
class CustomDividerView extends StatelessWidget {
final double dividerHeight;
final Color? color;
const CustomDividerView({
Key? key,
this.dividerHeight = 10.0,
this.color,
}) : assert(dividerHeight != 0.0),
super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: dividerHeight,
width: double.infinity,
color: color ?? Colors.grey[200],
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/widgets/responsive.dart | import 'package:flutter/material.dart';
class Responsive extends StatelessWidget {
const Responsive({
Key? key,
required this.mobile,
required this.tablet,
required this.desktop,
}) : super(key: key);
final Widget mobile;
final Widget tablet;
final Widget desktop;
static bool isMobile(BuildContext context) {
return MediaQuery.of(context).size.width < 650;
}
static bool isTablet(BuildContext context) {
return MediaQuery.of(context).size.width >= 650 && MediaQuery.of(context).size.width < 1100;
}
static bool isDesktop(BuildContext context) {
return MediaQuery.of(context).size.width >= 1100;
}
static bool isTabletDesktop(BuildContext context) {
return MediaQuery.of(context).size.width >= 650;
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth >= 1100) {
return desktop;
} else if (constraints.maxWidth >= 650) {
return tablet;
} else {
return mobile;
}
},
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/widgets/veg_badge_view.dart | import 'package:flutter/material.dart';
class VegBadgeView extends StatelessWidget {
const VegBadgeView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(2.0),
height: 15.0,
width: 15.0,
decoration: BoxDecoration(
border: Border.all(color: Colors.green[800]!),
),
child: ClipOval(
child: Container(
height: 5.0,
width: 5.0,
color: Colors.green[800],
),
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/widgets/dotted_seperator_view.dart | import 'package:flutter/material.dart';
class DottedSeperatorView extends StatelessWidget {
const DottedSeperatorView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: 8.0,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: 400,
itemBuilder: (context, index) => ClipOval(
child: Container(
margin: const EdgeInsets.all(3.0),
width: 2.0,
color: Colors.grey,
),
),
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/widgets | mirrored_repositories/SwiggyUI/lib/widgets/mobile/spotlight_best_top_food_item.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
import 'package:swiggy_ui/views/mobile/swiggy/restaurants/restaurant_detail_screen.dart';
import 'package:swiggy_ui/widgets/responsive.dart';
class SpotlightBestTopFoodItem extends StatelessWidget {
const SpotlightBestTopFoodItem({
Key? key,
required this.restaurant,
}) : super(key: key);
final SpotlightBestTopFood restaurant;
@override
Widget build(BuildContext context) {
final isTabletDesktop = Responsive.isTabletDesktop(context);
return InkWell(
onTap: isTabletDesktop
? () {}
: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const RestaurantDetailScreen(),
),
);
},
child: Container(
margin: const EdgeInsets.all(15.0),
child: Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.white,
boxShadow: const <BoxShadow>[
BoxShadow(
color: Colors.grey,
blurRadius: 2.0,
)
],
),
child: Image.asset(
restaurant.image,
height: 100.0,
width: 100.0,
fit: BoxFit.cover,
),
),
UIHelper.horizontalSpaceSmall(),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
restaurant.name,
maxLines: 1,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 18.0),
),
Text(
restaurant.desc,
maxLines: 2,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey[800], fontSize: 13.5),
),
UIHelper.verticalSpaceSmall(),
Text(
restaurant.coupon,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.red[900], fontSize: 13.0),
),
const Divider(),
FittedBox(
child: Row(
children: <Widget>[
Icon(
Icons.star,
size: 14.0,
color: Colors.grey[600],
),
Text(
restaurant.ratingTimePrice,
style: const TextStyle(fontSize: 12.0),
)
],
),
)
],
),
)
],
),
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/widgets | mirrored_repositories/SwiggyUI/lib/widgets/mobile/food_list_item_view.dart | import 'package:flutter/material.dart';
import '../../models/spotlight_best_top_food.dart';
import '../../utils/ui_helper.dart';
class FoodListItemView extends StatelessWidget {
final SpotlightBestTopFood restaurant;
const FoodListItemView({
Key? key,
required this.restaurant,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(10.0),
child: Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.white,
boxShadow: const <BoxShadow>[
BoxShadow(
color: Colors.grey,
blurRadius: 2.0,
)
],
),
child: Image.asset(
restaurant.image,
height: 80.0,
width: 80.0,
fit: BoxFit.fill,
),
),
UIHelper.horizontalSpaceMedium(),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
restaurant.name,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 18.0),
),
Text(restaurant.desc,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey[800], fontSize: 13.5)),
UIHelper.verticalSpaceExtraSmall(),
Text(
restaurant.coupon,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.red[900], fontSize: 13.0),
),
UIHelper.verticalSpaceSmall(),
Row(
children: <Widget>[
Icon(
Icons.star,
size: 14.0,
color: Colors.grey[600],
),
Text(restaurant.ratingTimePrice)
],
)
],
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/widgets | mirrored_repositories/SwiggyUI/lib/widgets/mobile/search_food_list_item_view.dart | import 'package:flutter/material.dart';
import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'package:swiggy_ui/utils/ui_helper.dart';
class SearchFoodListItemView extends StatelessWidget {
const SearchFoodListItemView({
Key? key,
required this.food,
}) : super(key: key);
final SpotlightBestTopFood food;
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(10.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.white,
boxShadow: const <BoxShadow>[
BoxShadow(
color: Colors.grey,
blurRadius: 2.0,
)
],
),
child: Image.asset(
food.image,
height: 80.0,
width: 80.0,
fit: BoxFit.fill,
),
),
UIHelper.horizontalSpaceSmall(),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
food.name,
style: Theme.of(context)
.textTheme
.subtitle2!
.copyWith(fontSize: 15.0),
),
Text(food.desc,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Colors.grey[600], fontSize: 13.5)),
UIHelper.verticalSpaceSmall(),
Row(
children: <Widget>[
Icon(
Icons.star,
size: 14.0,
color: Colors.grey[600],
),
Text(food.ratingTimePrice)
],
)
],
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/models/top_picks_food.dart | class TopPicksFood {
const TopPicksFood({
required this.image,
required this.name,
required this.minutes,
});
final String image;
final String name;
final String minutes;
static List<TopPicksFood> getTopPicksfoods() {
return const [
TopPicksFood(
image: 'assets/images/food5.jpg',
name: 'Murugan Idli Shop',
minutes: '42 mins'),
TopPicksFood(
image: 'assets/images/food4.jpg',
name: 'Thalappakati Biryani Hotel',
minutes: '32 mins'),
TopPicksFood(
image: 'assets/images/food1.jpg',
name: 'Sangeetha',
minutes: '26 mins'),
TopPicksFood(
image: 'assets/images/food2.jpg',
name: 'Hotel Chennai',
minutes: '38 mins'),
TopPicksFood(
image: 'assets/images/food3.jpg',
name: 'Shri Balaajee',
minutes: '53 mins'),
TopPicksFood(
image: 'assets/images/food4.jpg',
name: 'Namma Veedu Vasantha',
minutes: '22 mins'),
TopPicksFood(
image: 'assets/images/food6.jpg',
name: 'SK Parota Stall',
minutes: '13 mins'),
TopPicksFood(
image: 'assets/images/food7.jpg',
name: 'Aasife Biryani',
minutes: '31 mins'),
TopPicksFood(
image: 'assets/images/food8.jpg',
name: 'Jesus Fast Food',
minutes: '44 mins'),
TopPicksFood(
image: 'assets/images/food9.jpg',
name: 'Ananda Bhavan',
minutes: '55 mins'),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/models/popular_brands.dart | class PopularBrands {
const PopularBrands({
required this.image,
required this.name,
required this.minutes,
});
final String image;
final String name;
final String minutes;
static List<PopularBrands> getPopularBrands() {
return const [
PopularBrands(
image: 'assets/images/food5.jpg',
name: 'Sangeetha',
minutes: '42 mins'),
PopularBrands(
image: 'assets/images/food4.jpg',
name: 'Thalappakati',
minutes: '32 mins'),
PopularBrands(
image: 'assets/images/food1.jpg', name: 'Subway', minutes: '26 mins'),
PopularBrands(
image: 'assets/images/food2.jpg',
name: 'Chai Kings',
minutes: '38 mins'),
PopularBrands(
image: 'assets/images/food3.jpg',
name: 'BBQ Nation',
minutes: '53 mins'),
PopularBrands(
image: 'assets/images/food4.jpg',
name: 'A2B Chennai',
minutes: '22 mins'),
PopularBrands(
image: 'assets/images/food6.jpg', name: 'KFC', minutes: '13 mins'),
PopularBrands(
image: 'assets/images/food7.jpg',
name: 'Aasife Biryani',
minutes: '31 mins'),
PopularBrands(
image: 'assets/images/food8.jpg',
name: 'Chennai Biryani',
minutes: '44 mins'),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/models/genie.dart | class Genie {
const Genie({
required this.image,
required this.title,
});
final String image;
final String title;
static List<Genie> getGenieServices() {
return const [
Genie(image: 'assets/icons/home.png', title: 'Home\nFood'),
Genie(image: 'assets/icons/documents.png', title: 'Documents\nBooks'),
Genie(image: 'assets/icons/delivery.png', title: 'Business\nDeliveries'),
Genie(image: 'assets/icons/courier.png', title: 'Courier'),
Genie(image: 'assets/icons/more.png', title: 'Anything\nElse'),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/models/all_restaurant.dart | import 'package:swiggy_ui/models/spotlight_best_top_food.dart';
import 'indian_food.dart';
class AllRestaurant {
const AllRestaurant({
required this.image,
required this.name,
});
final String image;
final String name;
static List<AllRestaurant> getPopularTypes() {
return const [
AllRestaurant(
image: 'assets/icons/offer.png',
name: 'Offers\nNear You',
),
AllRestaurant(
image: 'assets/icons/world-cup.png',
name: 'Best\nSellers',
),
AllRestaurant(
image: 'assets/icons/pocket.png',
name: 'Pocket\nFriendly',
),
AllRestaurant(
image: 'assets/icons/only-on-swiggy.png',
name: 'Only on\nSwiggy',
),
AllRestaurant(
image: 'assets/icons/thunder.png',
name: 'Express\nDelivery',
),
AllRestaurant(
image: 'assets/icons/delivery.png',
name: 'Fast\nDelivery',
),
AllRestaurant(
image: 'assets/icons/blaze.png',
name: 'Blaze\nDelivery',
),
AllRestaurant(
image: 'assets/icons/spark.png',
name: 'Spark\nDelivery',
),
];
}
static List<SpotlightBestTopFood> getRestaurantListOne() {
return const [
SpotlightBestTopFood(
image: 'assets/images/food2.jpg',
name: 'Shiva Bhavan',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 35 mins - Rs 150 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food4.jpg',
name: 'Biryani Expresss',
desc: 'North Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '3.8 15 mins - Rs 200 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food7.jpg',
name: 'BBQ King',
desc: 'South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 25 mins - Rs 120 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food8.jpg',
name: 'Pizza Corner',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 47 mins - Rs 350 for two',
),
];
}
static List<SpotlightBestTopFood> getRestaurantListTwo() {
return const [
SpotlightBestTopFood(
image: 'assets/images/food4.jpg',
name: 'Biryani Expresss',
desc: 'North Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '3.8 15 mins - Rs 200 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food3.jpg',
name: 'A2B Chennai',
desc: 'South Indian',
coupon: '30 \$ off | Use A2BSUPER',
ratingTimePrice: '4.2 32 mins - Rs 130 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food2.jpg',
name: 'Murugan Idly',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 35 mins - Rs 150 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food7.jpg',
name: 'BBQ King',
desc: 'South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 25 mins - Rs 120 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food8.jpg',
name: 'Pizza Corner',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 47 mins - Rs 350 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food6.jpg',
name: 'Adyar Hotel',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 21 mins - Rs 150 for two',
),
];
}
static List<SpotlightBestTopFood> getRestaurantListThree() {
return const [
SpotlightBestTopFood(
image: 'assets/images/food4.jpg',
name: 'Biryani Expresss',
desc: 'North Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '3.8 15 mins - Rs 200 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food8.jpg',
name: 'Pizza Corner',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 47 mins - Rs 350 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food2.jpg',
name: 'Murugan Idly',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 35 mins - Rs 150 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food6.jpg',
name: 'Adyar Hotel',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 21 mins - Rs 150 for two',
),
];
}
static List<IndianFood> getIndianRestaurants() {
return const [
IndianFood(image: 'assets/images/food3.jpg', name: 'South\nIndian'),
IndianFood(image: 'assets/images/food5.jpg', name: 'Indian\nChai'),
IndianFood(image: 'assets/images/food1.jpg', name: 'North \nndian'),
IndianFood(image: 'assets/images/food8.jpg', name: 'Indian\nBiryani'),
IndianFood(image: 'assets/images/food9.jpg', name: 'Indian\nDosa'),
IndianFood(image: 'assets/images/food4.jpg', name: 'Indian\nIdly'),
];
}
static List<IndianFood> getPopularBrands() {
return const [
IndianFood(image: 'assets/images/food3.jpg', name: 'Sangeetha'),
IndianFood(image: 'assets/images/food5.jpg', name: 'Indian\nChai'),
IndianFood(image: 'assets/images/food1.jpg', name: 'Chai\nKings'),
IndianFood(image: 'assets/images/food8.jpg', name: 'Dosa\nMan'),
IndianFood(image: 'assets/images/food9.jpg', name: 'Subway'),
IndianFood(image: 'assets/images/food4.jpg', name: 'KFC'),
];
}
}
class LargeRestaurantBanner {
const LargeRestaurantBanner({
required this.image,
required this.title,
required this.subtitle,
});
final String image;
final String title;
final String subtitle;
static List<LargeRestaurantBanner> getBestInSafetyRestaurants() {
return const [
LargeRestaurantBanner(
image: 'assets/images/food8.jpg',
title: 'Namma Veedu Vasanta\n Bhavan',
subtitle: 'South Indian',
),
LargeRestaurantBanner(
image: 'assets/images/food9.jpg',
title: 'Chai Kings',
subtitle: 'Desserts, Tea, Milk',
),
LargeRestaurantBanner(
image: 'assets/images/food3.jpg',
title: 'Faaos',
subtitle: 'Desserts, Fast Food, Bakery, Biscuits',
),
LargeRestaurantBanner(
image: 'assets/images/food4.jpg',
title: 'Banu\n Bhavan',
subtitle: 'Biryani, Chicken, Mutton',
),
LargeRestaurantBanner(
image: 'assets/images/food8.jpg',
title: 'BBQ Nation',
subtitle: 'Chicken, Fried Chickent, Tandoori Chicken',
),
];
}
static List<LargeRestaurantBanner> getPepsiSaveOurRestaurants() {
return const [
LargeRestaurantBanner(
image: 'assets/images/food1.jpg',
title: 'Faasos',
subtitle: 'Fast Food, North Indian, Biryani, Desserts',
),
LargeRestaurantBanner(
image: 'assets/images/food2.jpg',
title: 'Hungry Pizza',
subtitle: 'Pizzas',
),
LargeRestaurantBanner(
image: 'assets/images/food7.jpg',
title: 'Paradise\n Bhavan',
subtitle: 'Biryani, Chicken, Mutton',
),
LargeRestaurantBanner(
image: 'assets/images/food10.jpg',
title: 'BBQ Nation',
subtitle: 'Chicken, Fried Chickent, Tandoori Chicken',
),
LargeRestaurantBanner(
image: 'assets/images/food3.jpg',
title: 'OMB Biryani',
subtitle: 'Biryani',
),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/models/indian_food.dart | class IndianFood {
const IndianFood({
required this.image,
required this.name,
});
final String image;
final String name;
static List<IndianFood> getIndianRestaurants() {
return const [
IndianFood(image: 'assets/images/food3.jpg', name: 'South\nIndian'),
IndianFood(image: 'assets/images/food5.jpg', name: 'Indian\nChai'),
IndianFood(image: 'assets/images/food1.jpg', name: 'North \nIndian'),
IndianFood(image: 'assets/images/food8.jpg', name: 'Indian\nBiryani'),
IndianFood(image: 'assets/images/food9.jpg', name: 'Indian\nDosa'),
IndianFood(image: 'assets/images/food4.jpg', name: 'Indian\nIdly'),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/models/spotlight_best_top_food.dart | class SpotlightBestTopFood {
const SpotlightBestTopFood({
required this.image,
required this.name,
required this.desc,
required this.coupon,
required this.ratingTimePrice,
});
final String image;
final String name;
final String desc;
final String coupon;
final String ratingTimePrice;
static List<List<SpotlightBestTopFood>> getSpotlightRestaurants() {
return const [
[
SpotlightBestTopFood(
image: 'assets/images/food1.jpg',
name: 'Breakfast Expresss',
desc: 'Continental North Indian, South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 45 mins - Rs 200 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food2.jpg',
name: 'Namma Veedu Bhavan',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 35 mins - Rs 150 for two',
),
],
[
SpotlightBestTopFood(
image: 'assets/images/food3.jpg',
name: 'A2B Chennai',
desc: 'South Indian',
coupon: '30 \$ off | Use A2BSUPER',
ratingTimePrice: '4.2 32 mins - Rs 130 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food4.jpg',
name: 'Dinner Expresss',
desc: 'North Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '3.8 25 mins - Rs 200 for two',
),
],
[
SpotlightBestTopFood(
image: 'assets/images/food5.jpg',
name: 'Parota King',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 55 mins - Rs 100 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food6.jpg',
name: 'Mass Hotel',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 22 mins - Rs 150 for two',
),
],
[
SpotlightBestTopFood(
image: 'assets/images/food7.jpg',
name: 'Mumbai Mirchi',
desc: 'South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 25 mins - Rs 120 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food8.jpg',
name: 'BBQ Nation',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 42 mins - Rs 350 for two',
),
]
];
}
static List<List<SpotlightBestTopFood>> getBestRestaurants() {
return const [
[
SpotlightBestTopFood(
image: 'assets/images/food6.jpg',
name: 'Mirchi Hotel',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 22 mins - Rs 150 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food1.jpg',
name: 'BBQ Expresss',
desc: 'Continental North Indian, South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 15 mins - Rs 200 for two',
),
],
[
SpotlightBestTopFood(
image: 'assets/images/food4.jpg',
name: 'Lunch Expresss',
desc: 'North Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '3.8 35 mins - Rs 200 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food3.jpg',
name: 'A2B Chennai',
desc: 'South Indian',
coupon: '30 \$ off | Use A2BSUPER',
ratingTimePrice: '4.2 42 mins - Rs 130 for two',
),
],
[
SpotlightBestTopFood(
image: 'assets/images/food6.jpg',
name: 'Mirchi Hotel',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 22 mins - Rs 150 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food5.jpg',
name: 'Parota World',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 25 mins - Rs 100 for two',
),
],
[
SpotlightBestTopFood(
image: 'assets/images/food7.jpg',
name: 'Chennai Mirchi',
desc: 'South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 25 mins - Rs 120 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food8.jpg',
name: 'BBQ Nation',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 45 mins - Rs 350 for two',
),
]
];
}
static List<List<SpotlightBestTopFood>> getTopRestaurants() {
return const [
[
SpotlightBestTopFood(
image: 'assets/images/food3.jpg',
name: 'A2B Chennai',
desc: 'South Indian',
coupon: '30 \$ off | Use A2BSUPER',
ratingTimePrice: '4.2 32 mins - Rs 130 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food4.jpg',
name: 'Biryani Expresss',
desc: 'North Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '3.8 15 mins - Rs 200 for two',
),
],
[
SpotlightBestTopFood(
image: 'assets/images/food1.jpg',
name: 'Chai Truck',
desc: 'Continental North Indian, South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 25 mins - Rs 200 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food2.jpg',
name: 'Shiva Bhavan',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 35 mins - Rs 150 for two',
),
],
[
SpotlightBestTopFood(
image: 'assets/images/food7.jpg',
name: 'BBQ King',
desc: 'South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 25 mins - Rs 120 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food8.jpg',
name: 'Pizza Corner',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 47 mins - Rs 350 for two',
),
],
[
SpotlightBestTopFood(
image: 'assets/images/food5.jpg',
name: 'Veg King',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 25 mins - Rs 100 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food6.jpg',
name: 'Adyar Hotel',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 21 mins - Rs 150 for two',
),
],
];
}
static List<SpotlightBestTopFood> getPopularAllRestaurants() {
return const [
SpotlightBestTopFood(
image: 'assets/images/food5.jpg',
name: 'Veg King',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 25 mins - Rs 100 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food6.jpg',
name: 'Adyar Hotel',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 21 mins - Rs 150 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food7.jpg',
name: 'Chennai Mirchi',
desc: 'South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 25 mins - Rs 120 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food8.jpg',
name: 'BBQ Nation',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 45 mins - Rs 350 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food3.jpg',
name: 'A2B Chennai',
desc: 'South Indian',
coupon: '30 \$ off | Use A2BSUPER',
ratingTimePrice: '4.2 32 mins - Rs 130 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food4.jpg',
name: 'Dinner Expresss',
desc: 'North Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '3.8 25 mins - Rs 200 for two',
),
];
}
static List<SpotlightBestTopFood> getTopGroceryRestaurants() {
return const [
SpotlightBestTopFood(
image: 'assets/images/food3.jpg',
name: 'A2B Chennai',
desc: 'South Indian',
coupon: '30 \$ off | Use A2BSUPER',
ratingTimePrice: '4.2 32 mins - Rs 130 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food4.jpg',
name: 'Biryani Expresss',
desc: 'North Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '3.8 15 mins - Rs 200 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food1.jpg',
name: 'Chai Truck',
desc: 'Continental North Indian, South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 25 mins - Rs 200 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food2.jpg',
name: 'Shiva Bhavan',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 35 mins - Rs 150 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food7.jpg',
name: 'BBQ King',
desc: 'South Indian',
coupon: '20 \$ off | Use JUMBO',
ratingTimePrice: '4.1 25 mins - Rs 120 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food8.jpg',
name: 'Pizza Corner',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 47 mins - Rs 350 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food5.jpg',
name: 'Veg King',
desc: 'South Indian',
coupon: '20 \$ off | Use SWIGGYIT',
ratingTimePrice: '4.1 25 mins - Rs 100 for two',
),
SpotlightBestTopFood(
image: 'assets/images/food6.jpg',
name: 'Adyar Hotel',
desc: 'South Indian',
coupon: '30 \$ off | Use JUMBO',
ratingTimePrice: '4.3 21 mins - Rs 150 for two',
),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/models/popular_category.dart | class PopularCategory {
const PopularCategory({
required this.image,
required this.name,
});
final String image;
final String name;
static List<PopularCategory> getPopularCategories() {
return const [
PopularCategory(
image: 'assets/icons/coffee.png',
name: 'Cold\nBeverages',
),
PopularCategory(
image: 'assets/icons/natural-food.png',
name: 'Veg only',
),
PopularCategory(
image: 'assets/icons/only-on-swiggy.png',
name: 'Only on\nSwiggy',
),
PopularCategory(
image: 'assets/icons/offer.png',
name: 'Offers',
),
PopularCategory(
image: 'assets/icons/food.png',
name: 'Meals',
),
PopularCategory(
image: 'assets/icons/milkshake.png',
name: 'Milkshakes',
),
PopularCategory(
image: 'assets/icons/kawaii-sushi.png',
name: 'Kawaii\n Sushi',
),
PopularCategory(
image: 'assets/icons/bread.png',
name: 'Bread',
),
PopularCategory(
image: 'assets/icons/only-on-swiggy.png',
name: 'Only on\nSwiggy',
),
PopularCategory(
image: 'assets/icons/food.png',
name: 'Meals',
),
PopularCategory(
image: 'assets/icons/natural-food.png',
name: 'Veg only',
),
PopularCategory(
image: 'assets/icons/coffee.png',
name: 'Cold\nBeverages',
),
PopularCategory(
image: 'assets/icons/kawaii-sushi.png',
name: 'Kawaii\n Sushi',
),
PopularCategory(
image: 'assets/icons/bread.png',
name: 'Bread',
),
PopularCategory(
image: 'assets/icons/food.png',
name: 'Meals',
),
PopularCategory(
image: 'assets/icons/milkshake.png',
name: 'Milkshakes',
),
PopularCategory(
image: 'assets/icons/coffee.png',
name: 'Cold\nBeverages',
),
PopularCategory(
image: 'assets/icons/natural-food.png',
name: 'Veg only',
),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/models/available_coupon.dart | class AvailableCoupon {
const AvailableCoupon({
required this.coupon,
required this.discount,
required this.desc,
});
final String coupon;
final String discount;
final String desc;
static List<AvailableCoupon> getAvailableCoupons() {
return const [
AvailableCoupon(
coupon: '100INDUSIND',
discount: 'Get 20 % discount using Induslnd Bank Credit Cards',
desc:
'Use code 100INDUSIND & get 20 % discount up to Rs100 on orders above Rs400',
),
AvailableCoupon(
coupon: 'HSBC500',
discount: 'Get 15 % discount using HSBC Bank Credit Cards',
desc:
'Use code HSBC500 & get 14 % discount up to Rs125 on orders above Rs500',
),
AvailableCoupon(
coupon: '100TMB',
discount: 'Get 20 % discount using TMB Bank Credit Cards',
desc:
'Use code 100TMB & get 20 % discount up to Rs100 on orders above Rs400',
),
AvailableCoupon(
coupon: 'INDUSIND20',
discount: 'Get 20 % discount using Induslnd Bank Credit Cards',
desc:
'Use code INDUSIND20 & get 20 % discount up to Rs200 on orders above Rs600',
),
AvailableCoupon(
coupon: 'HSBC5100',
discount: 'Get 20 % discount using Induslnd Bank Credit Cards',
desc:
'Use code HSBC5100 & get 20 % discount up to Rs100 on orders above Rs400',
),
AvailableCoupon(
coupon: '100AXIS',
discount: 'Get 20 % discount using Axis Bank Credit Cards',
desc:
'Use code 100AXIS & get 20 % discount up to Rs100 on orders above Rs400',
),
AvailableCoupon(
coupon: '100INDUSIND',
discount: 'Get 20 % discount using Induslnd Bank Credit Cards',
desc:
'Use code 100INDUSIND & get 20 % discount up to Rs100 on orders above Rs400',
),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/models/restaurant_detail.dart | class RestaurantDetail {
const RestaurantDetail({
required this.title,
required this.price,
this.image = '',
this.desc = '',
});
final String title;
final String price;
final String image;
final String desc;
static List<RestaurantDetail> getBreakfast() {
return const [
RestaurantDetail(
title: 'Idly(2Pcs) (Breakfast)',
price: 'Rs48',
image: 'assets/images/food1.jpg',
desc:
'A healthy breakfast item and an authentic south indian delicacy! Steamed and fluffy rice cake..more',
),
RestaurantDetail(
title: 'Sambar Idly (2Pcs)',
image: 'assets/images/food2.jpg',
price: 'Rs70',
),
RestaurantDetail(
title: 'Ghee Pongal',
image: 'assets/images/food3.jpg',
price: 'Rs85',
desc:
'Cute, button idlis with authentic. South Indian sambar and coconut chutney gives the per..more',
),
RestaurantDetail(
title: 'Boori (1Set)',
image: 'assets/images/food4.jpg',
price: 'Rs85',
),
RestaurantDetail(
title: 'Podi Idly(2Pcs)',
image: 'assets/images/food5.jpg',
price: 'Rs110',
),
RestaurantDetail(
title: 'Mini Idly with Sambar',
image: 'assets/images/food6.jpg',
price: 'Rs85',
desc:
'Cute, button idlis with authentic. South Indian sambar and coconut chutney gives the per..more',
),
];
}
static List<RestaurantDetail> getAllTimeFavFoods() {
return const [
RestaurantDetail(
title: 'Plain Dosa',
price: 'Rs30',
desc:
'A healthy breakfast item and an authentic south indian delicacy!',
),
RestaurantDetail(
title: 'Rava Dosa',
price: 'Rs70',
),
RestaurantDetail(
title: 'Onion Dosa',
price: 'Rs85',
desc:
'Cute, button dosas with authentic. South Indian sambar and coconut chutney gives the per..more',
),
RestaurantDetail(
title: 'Onion Uttapam',
price: 'Rs85',
),
RestaurantDetail(
title: 'Tomato Uttapam',
price: 'Rs110',
),
RestaurantDetail(
title: 'Onion Dosa & Sambar Vadai',
price: 'Rs85',
),
];
}
static List<RestaurantDetail> getOtherDishes() {
return const [
RestaurantDetail(
title: 'Kuzhi Paniyaram Karam (4Pcs)',
price: 'Rs70',
),
RestaurantDetail(
title: 'Kuzhi Paniyaram Sweet (4Pcs)',
price: 'Rs70',
),
RestaurantDetail(
title: 'Kuzhi Paniyaram Sweet & Karam (4Pcs)',
price: 'Rs110',
),
RestaurantDetail(
title: 'Ghee Kuzhi Paniyaram',
price: 'Rs85',
),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/models | mirrored_repositories/SwiggyUI/lib/models/tab_desktop/order_menu.dart | class OrderMenu {
const OrderMenu({
required this.image,
required this.title,
required this.quantity,
required this.price,
});
final String image;
final String title;
final int quantity;
final int price;
static List<OrderMenu> getCartItems() {
return const [
OrderMenu(
image: 'assets/images/food1.jpg',
title: 'Breakfast Expresss',
quantity: 3,
price: 140,
),
OrderMenu(
image: 'assets/images/food2.jpg',
title: 'Pizza Corner',
quantity: 1,
price: 160,
),
OrderMenu(
image: 'assets/images/food3.jpg',
title: 'BBQ King',
quantity: 2,
price: 230,
),
OrderMenu(
image: 'assets/images/food4.jpg',
title: 'Sea Emperor',
quantity: 6,
price: 30,
),
OrderMenu(
image: 'assets/images/food5.jpg',
title: 'Chai Truck',
quantity: 4,
price: 10,
),
OrderMenu(
image: 'assets/images/food8.jpg',
title: 'Thalappakatti',
quantity: 1,
price: 130,
),
OrderMenu(
image: 'assets/images/food9.jpg',
title: 'Eat & Meet',
quantity: 6,
price: 200,
),
OrderMenu(
image: 'assets/images/food6.jpg',
title: 'Anjapar Restaurant',
quantity: 4,
price: 190,
),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib/models | mirrored_repositories/SwiggyUI/lib/models/tab_desktop/menu.dart | import 'package:flutter/material.dart';
class Menu {
const Menu({
required this.icon,
required this.title,
});
final IconData icon;
final String title;
static List<Menu> getMenus() {
return const [
Menu(icon: Icons.home_outlined, title: 'Home'),
Menu(icon: Icons.search, title: 'Search'),
Menu(icon: Icons.shopping_bag_outlined, title: 'Orders'),
Menu(icon: Icons.local_offer_outlined, title: 'Offers'),
Menu(icon: Icons.person_outline, title: 'Profile'),
Menu(icon: Icons.more_horiz, title: 'More'),
];
}
}
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/utils/app_colors.dart | import 'package:flutter/material.dart';
const Color appColor = Colors.orange;
Color? darkOrange = Colors.deepOrange[800];
Color? swiggyOrange = Colors.orange[900];
| 0 |
mirrored_repositories/SwiggyUI/lib | mirrored_repositories/SwiggyUI/lib/utils/ui_helper.dart | import 'package:flutter/material.dart';
class UIHelper {
static const double _verticalSpaceExtraSmall = 4.0;
static const double _verticalSpaceSmall = 8.0;
static const double _verticalSpaceMedium = 16.0;
static const double _verticalSpaceLarge = 24.0;
static const double _verticalSpaceExtraLarge = 48;
static const double _horizontalSpaceExtraSmall = 4;
static const double _horizontalSpaceSmall = 8.0;
static const double _horizontalSpaceMedium = 16.0;
static const double _horizontalSpaceLarge = 24.0;
static const double _horizontalSpaceExtraLarge = 48.0;
static SizedBox verticalSpaceExtraSmall() =>
verticalSpace(_verticalSpaceExtraSmall);
static SizedBox verticalSpaceSmall() => verticalSpace(_verticalSpaceSmall);
static SizedBox verticalSpaceMedium() => verticalSpace(_verticalSpaceMedium);
static SizedBox verticalSpaceLarge() => verticalSpace(_verticalSpaceLarge);
static SizedBox verticalSpaceExtraLarge() =>
verticalSpace(_verticalSpaceExtraLarge);
static SizedBox verticalSpace(double height) => SizedBox(height: height);
static SizedBox horizontalSpaceExtraSmall() =>
horizontalSpace(_horizontalSpaceExtraSmall);
static SizedBox horizontalSpaceSmall() =>
horizontalSpace(_horizontalSpaceSmall);
static SizedBox horizontalSpaceMedium() =>
horizontalSpace(_horizontalSpaceMedium);
static SizedBox horizontalSpaceLarge() =>
horizontalSpace(_horizontalSpaceLarge);
static SizedBox horizontalSpaceExtraLarge() =>
horizontalSpace(_horizontalSpaceExtraLarge);
static SizedBox horizontalSpace(double width) => SizedBox(width: width);
}
| 0 |
mirrored_repositories/SwiggyUI | mirrored_repositories/SwiggyUI/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:swiggy_ui/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/Breathing-app | mirrored_repositories/Breathing-app/lib/main.dart | import 'package:flutter/material.dart';
import 'package:focus/screens/breathe_screen.dart';
import 'package:focus/screens/settings_screen.dart';
import 'package:provider/provider.dart';
import 'package:focus/state/settings.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider<Settings>(
builder: (context) => Settings(),
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
initialRoute: SettingsScreen.id,
routes: {
SettingsScreen.id: (context) => SettingsScreen(),
BreatheScreen.id: (context) => BreatheScreen(),
},
),
);
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/utilities/constants.dart | import 'package:flutter/material.dart';
typedef void ChangeCallback(double);
Color kSettingsButtonColor = Color(0xFFFAFAFA);
Color kSettingsButtonIconColor = Colors.lightBlueAccent;
TextStyle kCardTitleTextStyle = TextStyle(
fontSize: 20,
color: Colors.grey,
);
TextStyle kTitleTextStyle = TextStyle(
fontWeight: FontWeight.w200,
fontSize: 25,
letterSpacing: 3,
color: Colors.black,
);
TextStyle kBreathingTextStyle = TextStyle(
fontSize: 20,
);
double kSettingsButtonIconSize = 30.0;
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/utilities/breathing_animation.dart | import 'package:flutter/material.dart';
import 'dart:math';
class BreathingAnimation {
BreathingAnimation({
int initialSpeed = 2,
@required TickerProvider vsync,
double min = 0,
double max = 1,
Function didCompleteInBreath,
Function didCompleteOutBreath,
}) {
_speed = initialSpeed;
_animationController = AnimationController(vsync: vsync);
var curvedAnimation = CurvedAnimation(parent: _animationController, curve: Curves.easeInOutSine);
_animationController.duration = getDuration(fromSpeed: _speed);
_animationController.addStatusListener((status) {
if (status == AnimationStatus.completed) {
_animationController.reverse();
if (didCompleteInBreath != null) {
didCompleteInBreath();
}
} else if (status == AnimationStatus.dismissed) {
_animationController.forward();
if (didCompleteOutBreath != null) {
didCompleteOutBreath();
}
}
});
_tweenedAnimation = Tween<double>(begin: min, end: max).animate(curvedAnimation);
}
int _speed;
Animation _tweenedAnimation;
AnimationController _animationController;
Duration getDuration({@required int fromSpeed}) {
return Duration(milliseconds: (10000 / pow(1.35, fromSpeed)).floor());
}
double get value => _tweenedAnimation.value;
void start() {
_animationController.forward();
}
void stop() {
_animationController.stop();
}
void addListener(Function listener) {
_animationController.addListener(listener);
}
void updateSpeed(int newSpeed) {
if (newSpeed == _speed) {
return;
}
_speed = newSpeed;
double start = _animationController.value;
_animationController.duration = getDuration(fromSpeed: newSpeed);
if (_animationController.status == AnimationStatus.forward) {
_animationController.forward(from: start);
} else if (_animationController.status == AnimationStatus.reverse) {
_animationController.reverse(from: start);
}
}
void dispose() {
print('Disposing ticker');
_animationController.dispose();
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/components/time_slider_card.dart | import 'package:flutter/material.dart';
import 'package:focus/utilities/constants.dart';
class TimeSliderCard extends StatelessWidget {
const TimeSliderCard({
@required this.value,
@required this.onChanged,
@required this.title,
this.min = 30,
this.max = 300,
});
final int value;
final double min;
final double max;
final ChangeCallback onChanged;
final String title;
String get durationString => '${Duration(seconds: value).inMinutes}:${Duration(seconds: value).inSeconds.remainder(60).toString().padLeft(2, '0')}';
@override
Widget build(BuildContext context) {
return Card(
elevation: 5,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text(
title,
style: kCardTitleTextStyle,
),
Text(
durationString,
style: TextStyle(
fontSize: 45,
),
),
Slider(
value: value.toDouble(),
onChanged: onChanged,
min: min,
max: max,
divisions: ((max - min) / 5).floor(),
)
],
),
),
);
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/components/number_selection_card.dart | import 'package:flutter/material.dart';
import 'package:focus/components/round_button.dart';
import 'package:focus/utilities/constants.dart';
class NumberSelectionCard extends StatelessWidget {
const NumberSelectionCard({
@required this.value,
@required this.onChanged,
@required this.title,
});
final int value;
final ChangeCallback onChanged;
final String title;
@override
Widget build(BuildContext context) {
return Card(
elevation: 5,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: kCardTitleTextStyle,
),
Text(
value.toString(),
style: TextStyle(
fontSize: 45,
),
),
],
),
),
RoundButton(
color: kSettingsButtonColor,
child: Icon(
Icons.remove,
color: kSettingsButtonIconColor,
size: kSettingsButtonIconSize,
),
onPressed: () {
if (value > 1) {
onChanged(value - 1);
}
},
),
SizedBox(
width: 16,
),
RoundButton(
color: kSettingsButtonColor,
child: Icon(
Icons.add,
color: kSettingsButtonIconColor,
size: kSettingsButtonIconSize,
),
onPressed: () {
onChanged(value + 1);
},
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/components/animated_widget_sequence.dart | import 'package:flutter/material.dart';
import 'dart:async';
typedef void NextCallback({Duration delay});
typedef Widget SequenceItemBuilder(NextCallback next);
class AnimatedSwitcherSequenceController with ChangeNotifier {
void skipToNext() {
notifyListeners();
}
}
class AnimatedSwitcherSequence extends StatefulWidget {
AnimatedSwitcherSequence({@required this.builders, this.controller, this.beforeLoop}) {
if (builders.length < 2) {
throw FlutterError('AnimatedWidgetSequence must be passed at least 2 builder functions in the builders property.');
}
}
/// A list of builder functions, which are used to build the widgets in the sequence.
/// There must be at least 2 builder functions.
final List<SequenceItemBuilder> builders;
/// An optional controller which can be used to skip immediately to the next widget in the sequence.
final AnimatedSwitcherSequenceController controller;
/// This callback will be run before the sequence loops around to the first widget again.
final Function beforeLoop;
@override
_AnimatedSwitcherSequenceState createState() => _AnimatedSwitcherSequenceState();
}
class _AnimatedSwitcherSequenceState extends State<AnimatedSwitcherSequence> {
int currentWidget = 0;
Timer delayTimer;
AnimatedSwitcherSequenceController controller;
void _advanceWidget() {
if (currentWidget == widget.builders.length - 1) {
widget.beforeLoop?.call();
}
setState(() {
currentWidget = (currentWidget + 1) % widget.builders.length;
});
}
void next({Duration delay}) {
if (delay == null) {
delayTimer?.cancel();
delayTimer = null;
_advanceWidget();
return;
}
if (delayTimer != null) {
delayTimer.cancel();
}
delayTimer = Timer(delay, _advanceWidget);
}
@override
void initState() {
// TODO: implement initState
super.initState();
controller = widget.controller;
controller?.addListener(next);
}
@override
Widget build(BuildContext context) {
print(widget.builders);
return AnimatedSwitcher(
duration: Duration(seconds: 1),
child: widget.builders[currentWidget](next),
);
}
@override
void dispose() {
delayTimer?.cancel();
controller?.removeListener(next);
super.dispose();
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/components/round_container.dart | import 'package:flutter/material.dart';
class RoundContainer extends StatelessWidget {
const RoundContainer({
@required double radius,
this.child,
this.color = Colors.white,
}) : _circleRadius = radius;
final double _circleRadius;
final Widget child;
final Color color;
@override
Widget build(BuildContext context) {
return Material(
color: color,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: _circleRadius * 2,
maxWidth: _circleRadius * 2,
minHeight: _circleRadius * 2,
minWidth: _circleRadius * 2,
),
child: child,
),
borderRadius: (() {
return BorderRadius.circular(_circleRadius * 2);
})(),
elevation: 5,
);
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/components/round_button.dart | import 'package:flutter/material.dart';
class RoundButton extends StatelessWidget {
RoundButton({this.child, this.onPressed, this.color, this.height = 55.0});
final Widget child;
final Color color;
final Function onPressed;
final double height;
@override
Widget build(BuildContext context) {
return ButtonTheme(
padding: EdgeInsets.all(0),
minWidth: 55,
child: MaterialButton(
elevation: 1,
color: color,
onPressed: onPressed,
child: child,
shape: CircleBorder(),
height: height,
padding: EdgeInsets.all(0),
),
);
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/components/breathing_circle.dart | import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:focus/components/round_container.dart';
import 'package:focus/utilities/breathing_animation.dart';
import 'package:focus/state/settings.dart';
class BreathingCircleController extends ValueNotifier<bool> {
BreathingCircleController({bool animationShouldRun}) : super(animationShouldRun ?? false);
void stopAnimation() {
this.value = false;
}
void startAnimation() {
this.value = true;
}
}
class BreathingCircle extends StatefulWidget {
BreathingCircle({
this.didCompleteCycle,
this.child,
BreathingCircleController controller,
}) : _controller = controller;
final Function didCompleteCycle;
final Widget child;
final BreathingCircleController _controller;
@override
_BreathingCircleState createState() => _BreathingCircleState();
}
class _BreathingCircleState extends State<BreathingCircle> with SingleTickerProviderStateMixin {
static const double _baseRadius = 80;
double circleRadius = _baseRadius;
BreathingAnimation breathingAnimation;
BreathingCircleController controller;
Function listener;
Settings settings;
@override
void initState() {
// TODO: implement initState
super.initState();
controller = widget._controller ?? BreathingCircleController();
listener = () {
if (controller.value) {
breathingAnimation.start();
} else {
breathingAnimation.stop();
}
};
controller.addListener(listener);
}
@override
void didChangeDependencies() {
print(controller);
super.didChangeDependencies();
settings = Provider.of<Settings>(context);
if (breathingAnimation == null) {
breathingAnimation = BreathingAnimation(
vsync: this,
initialSpeed: settings.speed,
min: _baseRadius,
max: _baseRadius * 1.5,
didCompleteOutBreath: widget.didCompleteCycle,
);
breathingAnimation.addListener(() {
setState(() {
circleRadius = breathingAnimation.value;
});
});
controller.startAnimation();
} else {
breathingAnimation.updateSpeed(settings.speed);
}
}
@override
Widget build(BuildContext context) {
return RoundContainer(
radius: circleRadius,
color: Colors.lightBlueAccent[200],
child: Center(
child: widget.child,
),
);
}
@override
void dispose() {
breathingAnimation.dispose();
controller?.stopAnimation();
controller?.removeListener(listener);
super.dispose();
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/state/settings.dart | import 'package:flutter/material.dart';
class Settings extends ChangeNotifier {
int _numRounds = 3;
int _breathsPerRound = 35;
int _holdTime = 120;
int _speed = 6;
int get numRounds => _numRounds;
int get breathsPerRound => _breathsPerRound;
int get holdTime => _holdTime;
int get speed {
return _speed;
}
set numRounds(int newValue) {
_numRounds = newValue;
notifyListeners();
}
set breathsPerRound(int newValue) {
_breathsPerRound = newValue;
notifyListeners();
}
set holdTime(int newValue) {
_holdTime = newValue;
notifyListeners();
}
set speed(int newValue) {
_speed = newValue;
notifyListeners();
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/screens/breathe_screen.dart | import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'dart:async';
import 'package:slide_countdown_clock/slide_countdown_clock.dart';
import 'package:focus/utilities/breathing_animation.dart';
import 'package:focus/components/breathing_circle.dart';
import 'package:focus/state/settings.dart';
import 'package:focus/components/animated_widget_sequence.dart';
import 'package:focus/utilities/constants.dart';
enum CentralWidget {
breathingCircle,
breatheInText,
holdTimer1,
holdTimer2,
}
class BreatheScreen extends StatefulWidget {
static const String id = 'BreatheScreen';
@override
_BreatheScreenState createState() => _BreatheScreenState();
}
class _BreatheScreenState extends State<BreatheScreen> with SingleTickerProviderStateMixin {
int count = 0;
int roundsElapsed = 0;
CentralWidget centralWidget = CentralWidget.breathingCircle;
DateTime startTime;
BreathingCircleController breathingCircleController = BreathingCircleController();
AnimatedSwitcherSequenceController animatedSwitcherSequenceController = AnimatedSwitcherSequenceController();
// Widget getCentralWidget() {
// Settings settings = Provider.of<Settings>(context, listen: false);
// switch (centralWidget) {
// case CentralWidget.breathingCircle:
// return _buildBreathingCircle();
// break;
// case CentralWidget.breatheInText:
// return Text(
// 'Breathe In!',
// style: TextStyle(
// fontSize: 30,
// ),
// );
// break;
// case CentralWidget.holdTimer1:
// return _buildTimerWidget(settings.holdTime, () {
// setState(() {
// centralWidget = CentralWidget.breatheInText;
// });
//
// Future.delayed(Duration(milliseconds: 2500)).then((_) {
// setState(() {
// centralWidget = CentralWidget.holdTimer2;
// });
// });
// });
// break;
// case CentralWidget.holdTimer2:
// return _buildTimerWidget(10, () {
// int numRounds = settings.numRounds;
// roundsElapsed++;
//
// setState(() {
// if (roundsElapsed == numRounds) {
// return;
// }
// count = 0;
// centralWidget = CentralWidget.breathingCircle;
// startTime = null;
// });
//
// if (roundsElapsed == numRounds) {
// Navigator.pop(context);
// return;
// }
// });
// break;
// }
// }
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
brightness: Brightness.light,
backgroundColor: Colors.white,
iconTheme: IconThemeData(
color: Colors.lightBlueAccent,
),
title: Text(
'BREATHE',
style: TextStyle(
fontWeight: FontWeight.w200,
fontSize: 25,
letterSpacing: 3,
color: Colors.black,
),
),
),
body: Container(
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: Center(
child: AnimatedSwitcherSequence(
controller: animatedSwitcherSequenceController,
beforeLoop: () {
Settings settings = Provider.of<Settings>(context, listen: false);
count = 0;
roundsElapsed++;
if (roundsElapsed >= settings.numRounds) {
Navigator.pop(context);
}
},
builders: [
(next) {
next(delay: Duration(seconds: 4));
return Text(
'Get ready for round ${roundsElapsed + 1}',
style: kBreathingTextStyle,
);
},
(next) => _buildBreathingCircle(() {
Settings settings = Provider.of<Settings>(context, listen: false);
if (count + 1 == settings.breathsPerRound) {
breathingCircleController.stopAnimation();
setState(() {
count++;
});
next();
} else {
setState(() {
count++;
});
}
}),
(next) {
Settings settings = Provider.of<Settings>(context, listen: false);
return _buildTimerWidget(settings.holdTime, next);
},
(next) {
next(delay: Duration(seconds: 3));
return Text(
'Breathe In!',
style: kBreathingTextStyle,
);
},
(next) => _buildTimerWidget(10, next),
],
),
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: Center(
child: RaisedButton(
color: Colors.lightBlueAccent,
onPressed: () {
animatedSwitcherSequenceController.skipToNext();
},
child: Icon(
Icons.fast_forward,
color: Colors.white,
),
),
),
),
Container(
margin: EdgeInsets.only(bottom: 16.0),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Card(
elevation: 5,
child: Container(
width: double.infinity,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 24.0),
child: Consumer<Settings>(
builder: (context, settings, child) => Slider(
value: settings.speed.toDouble(),
onChanged: (value) {
if (value.floor() != settings.speed) {
settings.speed = value.floor();
}
},
min: 1,
max: 9,
),
),
),
),
),
),
)
],
),
),
);
}
Widget _buildBreathingCircle(Function didCompleteCycle) {
return BreathingCircle(
controller: breathingCircleController,
didCompleteCycle: didCompleteCycle,
child: Text(
count.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 60,
fontWeight: FontWeight.w100,
),
),
);
}
Widget _buildTimerWidget(int holdTime, Function onDone) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('HOLD'),
SlideCountdownClock(
textStyle: TextStyle(
fontSize: 50,
),
shouldShowHours: false,
separator: ':',
duration: Duration(seconds: holdTime),
onDone: onDone,
),
],
);
}
@override
void dispose() {
breathingCircleController.dispose();
super.dispose();
}
}
| 0 |
mirrored_repositories/Breathing-app/lib | mirrored_repositories/Breathing-app/lib/screens/settings_screen.dart | import 'package:flutter/material.dart';
import 'package:focus/components/time_slider_card.dart';
import 'package:focus/utilities/constants.dart';
import 'package:focus/components/number_selection_card.dart';
import 'package:focus/screens/breathe_screen.dart';
import 'package:provider/provider.dart';
import 'package:focus/state/settings.dart';
class SettingsScreen extends StatelessWidget {
static const String id = 'SettingsScreen';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
brightness: Brightness.light,
backgroundColor: Colors.white,
title: Text(
'SETTINGS',
style: TextStyle(
fontWeight: FontWeight.w200,
fontSize: 25,
letterSpacing: 3,
color: Colors.black,
),
),
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
NumberSelectionCard(
value: Provider.of<Settings>(context).numRounds,
title: 'Rounds',
onChanged: (newValue) {
Provider.of<Settings>(context).numRounds = newValue;
},
),
SizedBox(
height: 10.0,
),
NumberSelectionCard(
value: Provider.of<Settings>(context).breathsPerRound,
title: 'Breaths',
onChanged: (newValue) {
Provider.of<Settings>(context).breathsPerRound = newValue;
},
),
SizedBox(
height: 10.0,
),
Consumer<Settings>(
builder: (context, settings, child) => TimeSliderCard(
value: settings.holdTime,
onChanged: (newValue) {
if (newValue.ceil() != settings.holdTime) {
settings.holdTime = newValue.ceil();
}
},
title: 'Hold Time',
min: 5,
),
),
Expanded(
child: Container(),
),
MaterialButton(
minWidth: double.infinity,
color: Colors.lightBlueAccent,
height: 50.0,
onPressed: () {
Navigator.pushNamed(context, BreatheScreen.id);
},
child: Text(
'GO',
style: kTitleTextStyle.copyWith(
color: Colors.white,
),
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/Breathing-app | mirrored_repositories/Breathing-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:focus/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/SaveQuotes_FlutterApp | mirrored_repositories/SaveQuotes_FlutterApp/lib/quote_card.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'QuoteList.dart';
class quote_card extends StatelessWidget {
QuoteList e;
final Function delete;
quote_card({this.e,this.delete});
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.only(left: 8,right: 8,top: 8),
elevation: 5,
child: Padding(padding: EdgeInsets.all(16),
child: Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 9,
child: Column(children: <Widget>[
Text(
e.text,
style: TextStyle(
fontSize: 16,
color: Colors.black54,
),
),
],),
),
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
IconButton(
icon: Icon(Icons.delete),
onPressed:delete,
color: Colors.black45,
)
],),
)
],),
SizedBox(height: 10,),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text(
e.author,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black45,
),
),
],
),
],
),),
);
}
} | 0 |
mirrored_repositories/SaveQuotes_FlutterApp | mirrored_repositories/SaveQuotes_FlutterApp/lib/QuoteList.dart | class QuoteList{
String text;
String author;
QuoteList({this.text, this.author});
}
| 0 |
mirrored_repositories/SaveQuotes_FlutterApp | mirrored_repositories/SaveQuotes_FlutterApp/lib/DBProvider.dart | import 'package:flutter/cupertino.dart';
import 'package:quotes/QuoteList.dart';
import 'package:quotes/main.dart';
import 'package:sqflite/sqflite.dart';
import 'package:sqflite/sqlite_api.dart';
import 'package:path/path.dart';
class DBProvider {
DBProvider._();
static final DBProvider db = DBProvider._();
static Database _database;
static final _version =1;
Future<Database> get database async {
if (_database != null) {
return _database;
}
_database = await initDB();
return _database;
}
initDB() async {
return await openDatabase(
join(await getDatabasesPath(), 'quotes.db'),
onCreate: (db,version) async {
await db.execute('''
CREATE TABLE tQuotes(
text TEXT,author TEXT
)
''');
},
version: 1,
);
}
Future<void> insertQuote(QuoteList quote) async {
final Database db = await database;
await db.insert(
'tQuotes', quote.toMap(), conflictAlgorithm: ConflictAlgorithm.replace);
}
Future<List<QuoteList>> reQuotes() async {
final Database db = await database;
final List<Map<String,dynamic>> maps = await db.query('tQuotes');
return List.generate(maps.length, (i){
return QuoteList(
text: maps[i]['text'],
author: maps[i]['author']
);
});
}
Future<void> deleteQuote(String quotetoDel) async{
final Database db = await database;
await db.delete('tQuotes',where: "text = ?",whereArgs:[quotetoDel]);
}
newUser(QuoteList newUser) async {
final db = await database;
var res = await db.rawInsert('''
INSERT INTO tQuotes(
text,author
)VALUES(?,?)
''', [newUser.text, newUser.author]);
return res;
}
}
| 0 |
mirrored_repositories/SaveQuotes_FlutterApp | mirrored_repositories/SaveQuotes_FlutterApp/lib/main.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:quotes/quote_card.dart';
import 'QuoteList.dart';
void main() {
runApp(MaterialApp(
home: Home(),
));
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
List<QuoteList> list = [
QuoteList(text: "A friend is someone who knows all about you and still loves you.",author: "Elbert Hubbard"),
QuoteList(text: "Always forgive your enemies; nothing annoys them so much.",author: "Oscar Wilde"),
QuoteList(text: "Live as if you were to die tomorrow. Learn as if you were to live forever.",author: "Mahatma Gandhi"),
QuoteList(text: "You only live once, but if you do it right, once is enough.",author: "Mae West"),
];
final _formKey = GlobalKey<FormState>();
// QuoteList iQuote;
String iText="";
String iAuthor="";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("SaveQuotes"),
backgroundColor: Colors.black54,
actions: <Widget>[
Padding(padding: EdgeInsets.only(right: 16),
child: GestureDetector(onTap: (){
showDialog(
context: context,
builder: (BuildContext context){
return AlertDialog(
content: Form(
key: _formKey,
child: Column(
children: <Widget>[
TextFormField(
decoration: InputDecoration(
hintText: "Quote",
labelText: "Quote",
icon: Icon(Icons.format_quote)
),
validator:(String value){
if(value.isEmpty){
return "Enter quote";
}
} ,
onSaved: (String value){
print("Quote :"+value);
setState(() {
iText = value;
});
},
),
SizedBox(height: 20,),
TextFormField(
decoration: InputDecoration(
hintText: "Author",
labelText: "Author",
icon: Icon(Icons.person)
),
validator: (String value){
if(value.isEmpty){
return "Enter author name";
}
},
onSaved: (String value){
print("Author :"+value);
setState(() {
iAuthor = value;
});
},
),
SizedBox(height: 20,),
FlatButton.icon(
onPressed: (){
if(_formKey.currentState.validate()){
_formKey.currentState.save();
setState(() {
list.add(new QuoteList(text: iText,author: iAuthor));
});
Navigator.pop(context);
}
},
icon: Icon(Icons.add),
label: Text("Add"),
color: Colors.black54,
textColor: Colors.white,
),
],
mainAxisSize: MainAxisSize.min,
),
),
);
}
);
},
child: Icon(Icons.add_comment),
),
)
],
),
body:Column(children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(children:list.map((er) => quote_card(
e:er,
delete: (){
setState(() {
list.remove(er);
print("Heelo");
});
},
)).toList(),
),
),
],)
);
}
}
| 0 |
mirrored_repositories/client_money | mirrored_repositories/client_money/lib/my_icons_icons.dart | /// Flutter icons MyIcons
/// Copyright (C) 2022 by original authors @ fluttericon.com, fontello.com
/// This font was generated by FlutterIcon.com, which is derived from Fontello.
///
/// To use this font, place it in your fonts/ directory and include the
/// following in your pubspec.yaml
///
/// flutter:
/// fonts:
/// - family: MyIcons
/// fonts:
/// - asset: fonts/MyIcons.ttf
///
///
///
import 'package:flutter/widgets.dart';
class MyIcons {
MyIcons._();
static const _kFontFam = 'MyIcons';
static const String? _kFontPkg = null;
static const IconData visa_inc__logo_1 = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
}
| 0 |
mirrored_repositories/client_money | mirrored_repositories/client_money/lib/data.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sendmoney/model.dart';
List<UserTransaction> transactions = [
UserTransaction(
id: 0,
name: 'Сбербанк',
sum: 1200,
currency: 'Руб',
dataTime: Timestamp.now(),
),
UserTransaction(
id: 1,
name: 'Албфабанк',
sum: 4200,
currency: 'Руб',
dataTime: Timestamp.now(),
),
UserTransaction(
id: 2,
name: 'Тинькоф',
sum: 2200,
currency: 'Руб',
dataTime: Timestamp.now(),
),
UserTransaction(
id: 3,
name: 'ВТБ',
sum: 6200,
currency: 'Руб',
dataTime: Timestamp.now(),
),
UserTransaction(
id: 4,
name: 'Сбер',
sum: 5200,
currency: 'Руб',
dataTime: Timestamp.now(),
),
]; | 0 |
mirrored_repositories/client_money | mirrored_repositories/client_money/lib/functions.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:sendmoney/dataFiles/dataProfile.dart';
import 'package:sendmoney/model.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:sendmoney/models/moneyTransfer.dart';
import 'package:sendmoney/models/profileModel.dart';
import 'package:sendmoney/widgets/loginWidget.dart';
Future<List<UserTransaction>> getTransaction() async {
List<UserTransaction> transactions = [];
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
QuerySnapshot snapshot = await FirebaseFirestore.instance.collection('transactions').where('UID', isEqualTo: ProfileModel.id).get();
for(var item in snapshot.docs){
UserTransaction transaction = UserTransaction(
id: item.get("id"),
name: item.get("name"),
currency: item.get("currency"),
sum: item.get("sum").toDouble(),
dataTime: item.get('data'),
);
transactions.add(transaction);
}
return transactions;
}
List getProfiles(){
return profiles;
}
void setUserName(int idProfile, String value){
profiles[idProfile].name = value;
}
void setUserSurname(int idProfile, String value){
profiles[idProfile].surname = value;
}
void setUserNumber(int idProfile, String value){
profiles[idProfile].number = value;
}
Future getData() async {
await Firebase.initializeApp();
var firestore = FirebaseFirestore.instance;
QuerySnapshot qn = await firestore.collection('transactions').get();
return qn.docs;
}
Future<Future<DocumentReference<Object?>>> addTransaction(MoneyTransfer moneyTransfer)async {
CollectionReference transactions = await FirebaseFirestore.instance.collection('transactions');
return transactions
.add({
'UID' : ProfileModel.id,
'id' : 123,
'currency' : 'руб',
'name' : 'Сбербанк',
'sum' : moneyTransfer.sum,
'data' : Timestamp.now(),
});
}
Future<void> signOut() async {
ProfileModel.unset();
await FirebaseAuth.instance.signOut();
}
| 0 |
mirrored_repositories/client_money | mirrored_repositories/client_money/lib/model.dart | import 'package:cloud_firestore/cloud_firestore.dart';
class UserTransaction{
final int id;
final String name;
final double sum;
String currency;
Timestamp dataTime;
//String icon;
UserTransaction({required this.id, required this.name, required this.sum, required this.currency, required this.dataTime});
factory UserTransaction.fromJson(Map<String, dynamic> json) {
return UserTransaction(
id: json['id'],
name: json['name'],
sum: json['sum'],
currency: json['currency'],
dataTime: json[DateTime.now().microsecondsSinceEpoch]
);
}
} | 0 |
mirrored_repositories/client_money | mirrored_repositories/client_money/lib/main.dart | import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sendmoney/widgets/loginWidget.dart';
import 'package:sendmoney/pages/profile.dart';
import 'package:sendmoney/pages/transactionOk.dart';
import 'package:sendmoney/pages/transfer.dart';
import 'package:sendmoney/pages/userPanel.dart';
int balance = 7200;
Future<void> main () async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
return runApp( MaterialApp(
theme: ThemeData(
scaffoldBackgroundColor: Colors.grey.shade900,
fontFamily: 'SourceSansPro-Regular',
textTheme: const TextTheme(
headline3: TextStyle(
fontSize: 32,
color: Colors.white,
),
headline2: TextStyle(
fontSize: 20,
color: Colors.white,
),
headline6: TextStyle(
fontSize: 13,
color: Colors.white,
),
)
),
debugShowCheckedModeBanner: false,
initialRoute: '/loginPage',
routes: {
'/loginPage': (context) => LoginWidget(),
'/userPanel': (context) => UserPanel(),
'/transfer': (context) => Transfer(balance: balance),
'/transactionOk': (context) => TransactionOk(),
'/profile': (context) => Profile(),
},
));
}
| 0 |
mirrored_repositories/client_money/lib | mirrored_repositories/client_money/lib/widgets/cardView.dart |
import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:sendmoney/my_icons_icons.dart';
import 'package:flip_card/flip_card.dart';
Widget FlipCardView(context, balance){
return FlipCard(
front: Center(
child: Container(
height: 130,
width: 320,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
Colors.red,
Colors.purple,
]
)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(balance.toString(),
style: TextStyle(color: Colors.white, fontSize: 25),),
const SizedBox(
width: 75,
child: Icon(MyIcons.visa_inc__logo_1, color: Colors.white,))
//const Image(image: AssetImage('assets/icons/visaLogo2.png',))//Text()
],
)
),
),
back: Center(
child: Container(
height: 130,
width: 320,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
Colors.red,
Colors.purple,
]
)
),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('0000 0000 0000 0000', style: Theme.of(context).textTheme.headline2),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('00/00', style: Theme.of(context).textTheme.headline2),
Text('CVC: 000', style: Theme.of(context).textTheme.headline2),
],
)
],
),
)
),
)
);
}
Widget CardView(context,balance) {
return Center(
child: Container(
height: 130,
width: 320,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
Colors.red,
Colors.purple,
]
)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(balance.toString(),
style: Theme.of(context).textTheme.headline3,),
SizedBox(
width: 75,
child: const Icon(MyIcons.visa_inc__logo_1, color: Colors.white,))
//const Image(image: AssetImage('assets/icons/visaLogo2.png',))//Text()
],
)
),
);
} | 0 |
mirrored_repositories/client_money/lib | mirrored_repositories/client_money/lib/widgets/loginWidget.dart | import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sendmoney/models/profileModel.dart';
import '../functions.dart';
class LoginWidget extends StatefulWidget {
const LoginWidget({Key? key}) : super(key: key);
@override
State<LoginWidget> createState() => _LoginWidgetState();
}
class _LoginWidgetState extends State<LoginWidget> {
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
String login = '';
String password = '';
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.grey.shade900,
title: const Text('Авторизация', style: TextStyle(color: Colors.white)),
centerTitle: true,
),
body: SingleChildScrollView(
child: Form(
key: _formKey,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 10),
child: TextFormField(
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.all(Radius.circular(20))
),
hintText: 'Логин',
hintStyle: TextStyle(color: Colors.grey,)
),
onSaved: (value){
login = value.toString();
},
),
),
Padding(
padding: const EdgeInsets.only(top: 10),
child: TextFormField(
style: const TextStyle(color: Colors.white),
obscureText: true,
decoration: const InputDecoration(
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.all(Radius.circular(20))
),
hintText: 'Пароль',
hintStyle: TextStyle(color: Colors.grey,)
),
onSaved: (value){
password = value.toString();
},
),
),
Padding(
padding: const EdgeInsets.all(10),
child: SizedBox(
height: 50,
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.white,
),
onPressed: () async {
_formKey.currentState!.save();
try{
UserCredential userCredential = await FirebaseAuth.instance.signInWithEmailAndPassword(
email: login,
password: password,
);
ProfileModel.userCredential = userCredential;
ProfileModel.id = userCredential.user!.uid;
print('print-> ${ProfileModel.id}');
Navigator.pushNamedAndRemoveUntil(context, '/userPanel', (route) => false);
}catch (e){
showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
content: Text('Неправильный логин или пароль !', textAlign: TextAlign.center,),
actions: [
Center(child: TextButton(onPressed: () => Navigator.pop(context, 'Cancel'), child: const Text('Закрыть')))
],
)
);
}
},
child: const Text('Войти', style: TextStyle(color: Colors.black)),
),
),
)
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/client_money/lib | mirrored_repositories/client_money/lib/dataFiles/dataProfile.dart | import 'package:sendmoney/models/profileModel.dart';
List profiles = [
ProfileModel( name: 'Dias', surname: 'Suleimenov', number: '89533782106', avatarPatch: 'assets/image/avatar.jpg'),
ProfileModel( name: 'Aнатолий', surname: 'Хармач', number: '89990000000', avatarPatch: 'assets/image/avatar2.jpeg'),
]; | 0 |
mirrored_repositories/client_money/lib | mirrored_repositories/client_money/lib/pages/profile.dart | import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
import 'package:sendmoney/functions.dart';
import 'package:sendmoney/models/profileModel.dart';
class Profile extends StatelessWidget {
Profile(
{Key? key}) : super(key: key);
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
List profiles = getProfiles();
int idProfile = 1;
var maskFormatter = MaskTextInputFormatter(
mask: '+7 ### ### ## ##',
filter: { "#": RegExp(r'[0-9]') },
type: MaskAutoCompletionType.lazy
);
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.grey.shade900,
shadowColor: Colors.black.withOpacity(0),
title: Text('Профиль', style: Theme.of(context).textTheme.headline2),
centerTitle: true,
),
body:
SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: SafeArea(
child: Form(
key: _formKey,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector( /*todo: Сделать изменение фотографии по клику*/
child: Center(
child: CircleAvatar(
backgroundImage: AssetImage(profiles[idProfile].avatarPatch),
radius: 70,
),
),
),
],
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: TextFormField(
style: const TextStyle(color: Colors.white),
controller: TextEditingController(text: profiles[idProfile].name),
decoration: const InputDecoration(
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.all(Radius.circular(20))
),
hintText: 'Имя',
hintStyle: TextStyle(color: Colors.grey,)
),
validator: (value){
if(value==null|| value.isEmpty){
return 'Введите имя';
}
},
onSaved: (value){
setUserName(idProfile, value!);
},
),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: TextFormField(
style: const TextStyle(color: Colors.white),
controller: TextEditingController(text: profiles[idProfile].surname),
decoration: const InputDecoration(
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.all(Radius.circular(20))
),
hintText: 'Фамилия',
hintStyle: TextStyle(color: Colors.grey,)
),
validator: (value){
if(value==null|| value.isEmpty){
return 'Введите Фамилию';
}
},
onSaved: (value){
setUserSurname(idProfile, value!);
},
),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: TextFormField(
inputFormatters: [maskFormatter],
keyboardType: TextInputType.number,
style: const TextStyle(color: Colors.white),
controller: TextEditingController(text: profiles[idProfile].number),
decoration: const InputDecoration(
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.all(Radius.circular(20))
),
hintText: '+7 000 000 00 00',
hintStyle: TextStyle(color: Colors.grey,)
),
validator: (value){
if(value == null || value.isEmpty){
return 'Введите номер телефона';
}
},
onSaved: (value){
setUserNumber(idProfile, value!);
},
),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.white
),
child: const Text('Сохранить',style: TextStyle(color: Colors.black),),
onPressed: (){
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
print('Ok');
}
},
),
),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.white
),
child: const Text('Выпустить карту',style: TextStyle(color: Colors.black),),
onPressed: (){
showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
content: Text('Функция в разработке', textAlign: TextAlign.center,),
actions: [
Center(child: TextButton(onPressed: () => Navigator.pop(context, 'Cancel'), child: const Text('Cancel')))
],
)
);
}
),
),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.red.shade400
),
child: const Text('Выйти',style: TextStyle(color: Colors.black),),
onPressed: (){
signOut();
Navigator.pushNamedAndRemoveUntil(context, '/loginPage', (route) => false);
}
),
),
)
],
),
),
),
),
)
);
}
}
| 0 |
mirrored_repositories/client_money/lib | mirrored_repositories/client_money/lib/pages/transfer.dart |
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart';
import 'package:sendmoney/functions.dart';
import 'package:sendmoney/widgets/cardView.dart';
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
import '../models/moneyTransfer.dart';
final moneyFormat = NumberFormat.currency(
locale: 'ru',
symbol: '₽',
decimalDigits: 2,
);
class Transfer extends StatelessWidget {
final int balance;
Transfer({
Key? key,
required this.balance,
}) : super(key: key);
var maskFormatter = MaskTextInputFormatter(
mask: '#### #### #### ####',
filter: { "#": RegExp(r'[0-9]') },
type: MaskAutoCompletionType.lazy
);
final _formKey = GlobalKey<FormState>();
String cardStr = '';
String summ = '';
String messageRecipient = '';
MoneyTransfer moneyTransfer = MoneyTransfer();
@override
Widget build(BuildContext context) {
return Form(
key: _formKey,
child: Scaffold(
appBar: AppBar(
shadowColor: Colors.black.withOpacity(0),
backgroundColor: Colors.grey.shade900,
title: Text('Переводы', style: Theme.of(context).textTheme.headline2),
centerTitle: true,
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(child: CardView(context, moneyFormat.format(balance).toString())),
const Padding(padding: EdgeInsets.only(top: 10)),
TextFormField(
inputFormatters: [maskFormatter],
keyboardType: TextInputType.number,
validator: (value){
if(value == null || value.isEmpty){
return 'Введите номер карты верно';
}
else if(value.length != 19){
return 'Введите корректно номер карты';
}
return null;
},
onSaved: (value){
moneyTransfer.card = value;
},
style: const TextStyle(color: Colors.grey),
decoration: const InputDecoration(
border: UnderlineInputBorder(),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
labelText: 'Номер карты',
hintText: '0000 0000 0000 0000',
labelStyle: TextStyle(color: Colors.grey),
hintStyle: TextStyle(fontSize: 15, color: Colors.grey),
),
),
TextFormField(
validator: (value) {
if (value == null || value.isEmpty) {
return 'Введите сумму';
}
try {
if (int.parse(value) < 10 ||
int.parse(value) > 15000) {
return 'Сумма меньше 10р или больше 15 000р';
}
} on Exception catch (e) {
return ('Недопутимый формат');
}
return null;
},
onSaved: (value){
moneyTransfer.sum = double.parse(value!);
},
keyboardType: TextInputType.number,
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
border: UnderlineInputBorder(),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
labelText: 'от 10 до 15 000 р',
labelStyle: TextStyle(color: Colors.grey),
),
),
const Padding(padding: EdgeInsets.only(top: 30)),
TextFormField(
onSaved: (value){
moneyTransfer.messageUser = value;
},
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.all(Radius.circular(20))
),
hintText: 'Сообщение получателю',
hintStyle: TextStyle(fontSize: 13, color: Colors.grey),
),
),
const Padding(padding: EdgeInsets.only(top: 15)),
Center(
child: SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.white,
),
onPressed: () {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
addTransaction(moneyTransfer);
Navigator.pushNamedAndRemoveUntil(
context,
'/transactionOk',
(route)=>false
);
}
},
child: const Text('Перевести',
style: TextStyle(color: Colors.black)),
),
),
)
],
)
,
),
),
)
),
);
}
}
| 0 |
mirrored_repositories/client_money/lib | mirrored_repositories/client_money/lib/pages/transactionOk.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sendmoney/model.dart';
import 'package:sendmoney/pages/userPanel.dart';
class TransactionOk extends StatelessWidget {
const TransactionOk({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.green.shade900,
body: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [Icon(Icons.check, color: Colors.white, size: 100,),
Text('Перевод выполнен', style: TextStyle(color: Colors.white, fontSize: 20)),],
),
),
Padding(
padding: const EdgeInsets.all(20.0),
child: SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.white,
),
onPressed: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (BuildContext context) => UserPanel()
),
(route)=>false
);
},
child: const Text('Вернуться', style: TextStyle(color: Colors.black, fontSize: 20),)),
),
)
]
),
),
);
}
}
| 0 |
mirrored_repositories/client_money/lib | mirrored_repositories/client_money/lib/pages/userPanel.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:sendmoney/pages/transfer.dart';
import 'package:sendmoney/widgets/cardView.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:sendmoney/model.dart';
import '../functions.dart';
final moneyFormat = NumberFormat.currency(
locale: 'ru',
symbol: 'руб',
decimalDigits: 0,
);
class UserPanel extends StatefulWidget {
const UserPanel({Key? key}) : super(key: key);
@override
State<UserPanel> createState() => _UserPanelState();
}
class _UserPanelState extends State<UserPanel> {
String userName = 'Анатолий Хармач';
String avatarPath = 'assets/image/avatar2.jpeg';
int balance = 7200;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey.shade900,
appBar: AppBar(
shadowColor: Colors.black.withOpacity(0),
backgroundColor: Colors.grey.shade900,
leading: PopupMenuButton(
icon: const Icon(Icons.border_all_sharp, color: Colors.white),
itemBuilder: (BuildContext context) {
return [
PopupMenuItem(child: TextButton(
onPressed: () {
Navigator.pushNamed(context, '/profile');
},
child: const Text('Профиль', style: TextStyle(color: Colors.black),))),
PopupMenuItem(child: TextButton(
onPressed: () {
Navigator.pushNamed(context, '/transfer');
},
child: const Text('Перевести', style: TextStyle(color: Colors.black),))),
PopupMenuItem(child: TextButton(
onPressed: () {
signOut();
Navigator.pushNamedAndRemoveUntil(context, '/loginPage', (route) => false);
},
child: const Text('Выйти', style: TextStyle(color: Colors.black),))),
];
},
),
title: Text(userName, style: const TextStyle(color: Colors.white,fontSize: 23)),
centerTitle: true,
actions: [
Padding(
padding: const EdgeInsets.only(right: 20),
child: GestureDetector(
child: Center(
child: CircleAvatar(
backgroundImage: AssetImage(avatarPath),
radius: 20,),
),
onTap: () {
Navigator.pushNamed(context, '/profile');
}
),
),
],
),
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(padding: EdgeInsets.only(top: 40)),
FlipCardView(context, moneyFormat.format(balance)),
ButtonTransaction(),
WidjetTransactions(),
],
),
),
);
}
}
class ButtonTransaction extends StatelessWidget {
const ButtonTransaction({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(20.0),
child: Center(
child: SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.white,
),
onPressed: () {
Navigator.pushNamed(context, '/transfer');
},
child: const Text('Перевести деньги',
style: TextStyle(color: Colors.black)
,)),
),
),
);
}
}
class WidjetTransactions extends StatefulWidget {
const WidjetTransactions({Key? key}) : super(key: key);
@override
_WidjetTransactionsState createState() => _WidjetTransactionsState();
}
class _WidjetTransactionsState extends State<WidjetTransactions> {
late Future<List<UserTransaction>> transaction;
@override
void initState() {
super.initState();
transaction = getTransaction();
}
@override
Widget build(BuildContext context) {
return Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Center(
child: Text('Транзакции',
style: Theme.of(context).textTheme.headline2,
),
),
const Padding(
padding: EdgeInsets.only(top: 10),
child: Divider(
height: 5,
thickness: 2,
indent: 30,
endIndent: 30,
color: Colors.black12,
),
),
Expanded(
child: FutureBuilder<List<UserTransaction>>(
future: transaction,
builder: (BuildContext context, snapshot) {
if(snapshot.hasData && snapshot.data?.length!=0){
List<UserTransaction> transaction = snapshot.data as List<UserTransaction>;
transaction.sort((a,b)=> b.dataTime.compareTo(a.dataTime));
return ListView.builder(
itemCount: transaction.length,
itemBuilder: (BuildContext context, int index){
return ListTile(
leading: const Icon(
Icons.payment, color: Colors.white,),
title: Center(child: Text(
transaction[index].name, style: Theme
.of(context)
.textTheme
.headline2)),
trailing: Text(moneyFormat.format(transaction[index].sum).toString(),
style: Theme
.of(context)
.textTheme
.headline2,),
);
},
);
}
else if(snapshot.hasError){
return Text('Error - ${snapshot.error}', style: TextStyle(color: Colors.white));
}
else if(snapshot.data?.length == 0){
return Center(child: Text('Вы еще не совершали переводы', style: TextStyle(color: Colors.white, fontSize: 18)));
}
else {
return const Center(
child: CircularProgressIndicator(),
);
}
}
)
)
],
),
),
);
}
}
| 0 |
mirrored_repositories/client_money/lib | mirrored_repositories/client_money/lib/models/profileModel.dart | import 'package:firebase_auth/firebase_auth.dart';
class ProfileModel{
static late var userCredential;
static late var id;
String name;
String surname;
String number;
String avatarPatch;
ProfileModel({required this.name, required this.surname,required this.number, required this.avatarPatch});
static void unset(){
userCredential = null;
id = null;
}
} | 0 |
mirrored_repositories/client_money/lib | mirrored_repositories/client_money/lib/models/moneyTransfer.dart | class MoneyTransfer{
String? card;
double? sum;
String? messageUser;
MoneyTransfer({
this.card,
this.sum,
this.messageUser});
}
| 0 |
mirrored_repositories/OneSarkel | mirrored_repositories/OneSarkel/lib/main.dart | import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/services/auth.dart';
import 'package:provider/provider.dart';
import 'models/user.dart';
import 'screens/auth/wrapper.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final AuthService _authService = AuthService();
@override
Widget build(BuildContext context) {
return StreamProvider<CurrentUser>.value(
value: _authService.user,
catchError: (_, __) => null,
child: FutureProvider<UserData>.value(
catchError: (_, __) => null,
value: _authService.getCurrentUser() ?? UserData(),
child: MaterialApp(
title: 'Messaging',
debugShowCheckedModeBanner: false,
theme: ThemeData(
fontFamily: "Roboto",
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: Wrapper(),
),
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/components/header_text.dart | import 'package:flutter/material.dart';
class HeaderTextWidget extends StatelessWidget {
const HeaderTextWidget({
Key key,
@required this.headerAlignment,
@required this.headerPadding,
@required this.headerTextSize,
@required this.title,
}) : super(key: key);
final Alignment headerAlignment;
final EdgeInsets headerPadding;
final double headerTextSize;
final String title;
@override
Widget build(BuildContext context) {
return Container(
alignment: headerAlignment,
padding: headerPadding,
child: AnimatedDefaultTextStyle(
style: TextStyle(
color: Colors.white,
fontSize: headerTextSize,
),
duration: Duration(milliseconds: 200),
curve: Curves.easeIn,
child: Text(
title,
),
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/components/contact_tile.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/screens/chat_screen.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
class ContactTile extends StatelessWidget {
const ContactTile({
Key key,
this.userData,
}) : super(key: key);
final UserData userData;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) => ChatScreen(
reciever: userData,
),
),
);
},
child: ListTile(
leading: Icon(
Icons.people,
color: Colors.white,
),
title: Text(
userData.username,
style: TextStyle(
color: Colors.white,
),
),
subtitle: Text(
"${userData.email}",
style: TextStyle(
color: Colors.white,
),
),
trailing: Icon(
Icons.block,
color: SamsungColor.lightGrey,
),
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/components/home_screen_nav_bar.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
class HomeScreenBottomNavBar extends StatelessWidget {
HomeScreenBottomNavBar({
Key key,
@required int page,
this.navigationTapped,
}) : _page = page,
super(key: key);
final int _page;
final Function navigationTapped;
@override
Widget build(BuildContext context) {
return CupertinoTabBar(
border: Border(
top: BorderSide.none,
),
onTap: navigationTapped,
currentIndex: _page,
backgroundColor: SamsungColor.black,
items: [
BottomNavigationBarItem(
title: Container(
padding: EdgeInsets.all(10.0),
child: Text(
"Conversations",
style: TextStyle(
color: _page == 0
? SamsungColor.primaryDark
: SamsungColor.lightGrey,
fontSize: 18.0,
),
),
),
icon: Container(),
),
BottomNavigationBarItem(
title: Container(
padding: EdgeInsets.all(10.0),
child: Text(
"Contatcs",
style: TextStyle(
color: _page == 1
? SamsungColor.primaryDark
: SamsungColor.lightGrey,
fontSize: 18.0,
),
),
),
icon: Container(),
)
],
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/components/utilities.dart | import "dart:math";
List<String> usernamePrefixList = [
'sparrow',
'jey',
'blackbird',
'dove',
];
String username;
class Utilities {
static String getUsername(String email) {
String username = "_${email.split('@')[0]}";
// generates a new Random object
// generate a random index based on the list length
// and use it to retrieve the element
var element =
usernamePrefixList[Random().nextInt(usernamePrefixList.length)];
username = element + username + Random().nextInt(100).toString();
return username;
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/components/chat_tile.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/screens/chat_screen.dart';
class ChatTile extends StatelessWidget {
const ChatTile({
Key key,
this.userData,
}) : super(key: key);
final UserData userData;
@override
Widget build(BuildContext context) {
return ListTile(
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) => ChatScreen(
reciever: userData,
),
),
);
},
leading: Icon(
Icons.people,
color: Colors.white,
),
title: Text(
"${userData.username}",
style: TextStyle(
color: Colors.white,
),
),
subtitle: Text(
"This is a message...",
style: TextStyle(
color: Colors.white,
),
),
trailing: Text(
userData.lastActive.toString().replaceRange(5, 7, "") ?? "",
style: TextStyle(
color: Colors.white,
),
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/models/message.dart | import 'package:cloud_firestore/cloud_firestore.dart';
class Message {
String senderId;
String recieverId;
Timestamp timestamp;
String messageText;
Message({
this.senderId,
this.recieverId,
this.timestamp,
this.messageText,
});
Map toMap() {
Map map = Map<String, dynamic>();
map['senderId'] = this.senderId;
map['recieverId'] = this.recieverId;
map['timestamp'] = this.timestamp;
map['messageText'] = this.messageText;
return map;
}
Message fromMap(Map<String, dynamic> map) {
Message _message = Message();
_message.senderId = map['senderId'];
_message.recieverId = map['recieverId'];
_message.timestamp = map['timestamp'];
_message.messageText = map['messageText'];
return _message;
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/models/user.dart | class CurrentUser {
String userId;
String email;
String username;
CurrentUser({
this.userId,
this.email,
this.username,
});
}
class UserData {
String uid;
String username;
String email;
String lastActive;
UserData({
this.uid,
this.username,
this.email,
this.lastActive,
});
UserData.fromMap(Map<String, dynamic> mapData) {
this.uid = mapData['uid'];
this.username = mapData['username'];
this.email = mapData['email'];
this.lastActive = mapData['lastActive'];
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/theme/samsung_color.dart | import 'package:flutter/material.dart';
class SamsungColor {
static Color primary = Color(0xff0381fe);
static Color primaryDark = Color(0xff0072de);
static Color colorControlActive = Color(0xff3e91ff);
static Color white = Color(0xfffafafa);
static Color black = Color(0xff000000);
static Color magenta = Color.fromARGB(100, 233, 58, 170);
static Color yellow = Color.fromARGB(100, 238, 169, 78);
static Color lightGrey = Color.fromARGB(100, 217, 208, 217);
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/services/auth.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter_samsung_messaging_app_clone/components/utilities.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/services/database.dart';
Firestore firestore = Firestore();
class AuthService {
final FirebaseAuth _auth = FirebaseAuth.instance;
Stream<CurrentUser> get user {
return _auth.onAuthStateChanged.map(_userFromFirebase);
}
CurrentUser _userFromFirebase(FirebaseUser user) {
return user == null
? null
: CurrentUser(
userId: user.uid,
email: user.email,
username: Utilities.getUsername(user.email));
}
Future signIn(String email, String password) async {
try {
AuthResult result;
result = await _auth.signInWithEmailAndPassword(
email: email,
password: password,
);
FirebaseUser currentUser = result.user;
return _userFromFirebase(currentUser);
} catch (e) {
print("Error from Firebase Email and password sign in: $e");
return null;
}
}
Future register(
String email,
String password,
) async {
print("starting create user process. email is $email."
" and password is$password");
try {
AuthResult result;
result = await _auth.createUserWithEmailAndPassword(
email: email,
password: password,
);
FirebaseUser currentUser = result.user;
// While a new user is created the user data is updated with a new user
// name which is generated by a separate utility.
await DatabaseService(uid: currentUser.uid).updateUserData(
Utilities.getUsername(currentUser.email),
currentUser.email,
currentUser.metadata.lastSignInTime.toLocal().toString(),
);
return _userFromFirebase(currentUser);
} catch (e) {
return null;
}
}
Future<void> signOut() async {
await _auth.signOut();
}
Future<UserData> getCurrentUser() async {
FirebaseUser currentUser;
await _auth.currentUser().then((user) {
currentUser = user;
});
String username;
// get the current user name for the current user from the cloud
// firestore
await firestore
.collection("users")
.document(currentUser.uid)
.get()
.then((value) => username = value.data["username"]);
return UserData(
uid: currentUser.uid,
username: username,
email: currentUser.email,
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/services/database.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter_samsung_messaging_app_clone/models/message.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/services/auth.dart';
class DatabaseService {
final String uid;
DatabaseService({this.uid});
final CollectionReference userCollection =
Firestore.instance.collection('users');
Future updateUserData(
String username, String email, String lastActive) async {
return await userCollection.document(uid).setData({
"uid": this.uid,
"username": username,
"email": email,
"lastActive": lastActive,
});
}
List<UserData> _updateUserDataFromSnapshot(QuerySnapshot snapshot) {
// this is a private function which takes a firestore snapshot
// and turns simplifies this using a userData model. After retrieving all
// the user model, it then turns them into a list, which is needed to be.
List<UserData> userDataList = snapshot.documents
.map((document) {
return UserData(
uid: document.documentID,
username: document.data["username"],
email: document.data["email"],
lastActive: document.data["lastActive"],
);
})
.where((userData) => userData.uid != this.uid)
.toList();
return userDataList;
}
Stream<List<UserData>> get userData {
// It gets the user data from the firestore
// and turns this into a more simplified object
// with only two properties.
return userCollection.snapshots().map(_updateUserDataFromSnapshot);
}
Future<void> addMessagesToFirestore(
Message message,
UserData reciever,
UserData sender,
) async {
var map = message.toMap();
await firestore
.collection("messages")
.document(message.senderId)
.collection(message.recieverId)
.add(map);
await firestore
.collection("messages")
.document(message.recieverId)
.collection(message.senderId)
.add(map);
}
Future<DocumentSnapshot> getMessageFromFirestore() async {
DocumentSnapshot messageDocument;
QuerySnapshot snapshot =
await firestore.collection("messages").getDocuments();
for (int index = 0; index < snapshot.documents.length; index++) {
var a = snapshot.documents[index];
if (a.documentID == uid) {
messageDocument = a;
}
}
return messageDocument;
}
Future<List<UserData>> fetchUserCollection(UserData currentUser) async {
List<UserData> userList = List<UserData>();
QuerySnapshot querySnapshot =
await firestore.collection("users").getDocuments();
for (var index = 0; index < querySnapshot.documents.length; index++) {
if (querySnapshot.documents[index].documentID != currentUser.uid) {
userList.add(UserData.fromMap(querySnapshot.documents[index].data));
}
}
return userList;
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/screens/profile_screen.dart | import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
class ProfileScreen extends StatefulWidget {
ProfileScreen({Key key}) : super(key: key);
@override
_ProfileScreenState createState() => _ProfileScreenState();
}
class _ProfileScreenState extends State<ProfileScreen> {
@override
Widget build(BuildContext context) {
return Container(
child: Scaffold(
appBar: AppBar(
backgroundColor: SamsungColor.black,
),
body: Container(
color: SamsungColor.black,
child: Column(
children: [
Container(
height: 200.0,
alignment: Alignment.bottomCenter,
width: double.infinity,
child: Text(
"username348u5",
style: TextStyle(
color: Colors.white,
fontSize: 22.0,
fontWeight: FontWeight.w700,
),
),
),
Text(
"Media, Links, Docs",
style: TextStyle(
color: Colors.white,
fontSize: 18.0,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SizedBox(
width: 50.0,
child: Image.network(
"https://images.homedepot-static.com/productImages/84e72c36-570c-4768-9e46-fae15fc5a5ea/svn/home-decorators-collection-dimensional-wall-art-1865642270-64_1000.jpg",
),
),
SizedBox(
width: 50.0,
child: Image.network(
"https://images.homedepot-static.com/productImages/84e72c36-570c-4768-9e46-fae15fc5a5ea/svn/home-decorators-collection-dimensional-wall-art-1865642270-64_1000.jpg",
),
),
SizedBox(
width: 50.0,
child: Image.network(
"https://images.homedepot-static.com/productImages/84e72c36-570c-4768-9e46-fae15fc5a5ea/svn/home-decorators-collection-dimensional-wall-art-1865642270-64_1000.jpg",
),
),
],
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/screens/chat_screen.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/models/message.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/screens/profile_screen.dart';
import 'package:flutter_samsung_messaging_app_clone/services/database.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
import 'package:provider/provider.dart';
final messageFieldController = TextEditingController();
final DatabaseService _databaseService = DatabaseService();
ScrollController _listScrollController;
bool _isOnTop = true;
FocusNode _focus = FocusNode();
class ChatScreen extends StatefulWidget {
final UserData reciever;
ChatScreen({this.reciever});
@override
_ChatScreenState createState() => _ChatScreenState();
}
class _ChatScreenState extends State<ChatScreen> {
void navigateToProfile() {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProfileScreen(),
),
);
}
void _onFocusChange() {
if (_focus.hasFocus) {
print("keyboard focused");
}
}
@override
void initState() {
super.initState();
_listScrollController = ScrollController(initialScrollOffset: 20.0);
_focus.addListener(_onFocusChange);
}
@override
void dispose() {
super.dispose();
_listScrollController.dispose();
}
@override
Widget build(BuildContext context) {
UserData currentUser = Provider.of<UserData>(context) ?? UserData();
_scrollToBottom() {
_listScrollController.animateTo(
_listScrollController.position.maxScrollExtent,
duration: Duration(milliseconds: 250),
curve: Curves.easeOut);
setState(() => _isOnTop = false);
}
sendMessage(UserData reciever) {
var text = messageFieldController.text;
if (text.length > 0) {
Message _message = Message(
recieverId: reciever.uid,
senderId: currentUser.uid,
timestamp: Timestamp.now(),
messageText: text,
);
_databaseService.addMessagesToFirestore(
_message,
reciever,
currentUser,
);
messageFieldController.clear();
}
}
return SafeArea(
child: Scaffold(
appBar: AppBar(
backgroundColor: SamsungColor.black,
elevation: 0.0,
title: GestureDetector(
child: Text("${widget.reciever.username}"),
onTap: navigateToProfile,
),
actions: [
IconButton(
icon: Icon(Icons.call),
onPressed: () {},
),
IconButton(
icon: Icon(Icons.more_vert),
onPressed: () {},
),
],
),
body: StreamBuilder(
stream: Firestore.instance
.collection("messages")
.document(currentUser.uid)
.collection(widget.reciever.uid)
.orderBy("timestamp", descending: false)
.snapshots(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
return snapshot.data == null
? Container(
color: SamsungColor.black,
child: Center(
child: CircularProgressIndicator(),
))
: Container(
color: SamsungColor.black,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: ListView.builder(
controller: _listScrollController,
itemBuilder: (BuildContext context, int index) {
bool isSender = snapshot.data.documents[index]
["senderId"] ==
currentUser.uid;
return Padding(
padding: EdgeInsets.all(20.0),
child: Container(
decoration: isSender
? BoxDecoration(
color: SamsungColor.primaryDark,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(50),
bottomLeft: Radius.circular(50.0),
topRight: Radius.circular(60.0),
),
)
: BoxDecoration(
color: SamsungColor.primary,
borderRadius: BorderRadius.only(
topRight: Radius.circular(50),
bottomRight: Radius.circular(50.0),
topLeft: Radius.circular(60.0),
),
),
margin: isSender
? EdgeInsets.only(
left: 60.0,
top: 16.0,
right: 10.0,
)
: EdgeInsets.only(
left: 10.0,
top: 16.0,
right: 60.0,
),
padding: EdgeInsets.all(10.0),
// height: 40.0,
// width: 30.0,
child: Padding(
padding: EdgeInsets.all(10.0),
child: Text(
snapshot.data.documents[index]
["messageText"],
textAlign: isSender
? TextAlign.right
: TextAlign.left,
style: TextStyle(
color: Colors.white,
),
),
),
),
);
},
itemCount: snapshot.data.documents.length,
),
),
Padding(
padding: const EdgeInsets.all(20.0),
child: Row(
children: [
Expanded(
flex: 5,
child: Container(
// height: 50.0,
child: TextField(
focusNode: _focus,
style: TextStyle(
color: SamsungColor.black,
fontSize: 20.0),
controller: messageFieldController,
cursorColor: Colors.black,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(20.0),
border: OutlineInputBorder(
borderRadius:
BorderRadius.circular(60.0),
borderSide: BorderSide.none,
),
fillColor: Colors.white,
filled: true,
),
),
),
),
Expanded(
flex: 1,
child: IconButton(
iconSize: 40.0,
icon: Icon(Icons.send),
onPressed: () {
_scrollToBottom();
sendMessage(widget.reciever);
},
color: SamsungColor.primary,
),
),
],
),
),
],
),
);
},
),
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/screens/login_screen.dart | import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/services/auth.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
class LogInScreen extends StatefulWidget {
LogInScreen({Key key}) : super(key: key);
@override
_LogInScreenState createState() => _LogInScreenState();
}
class _LogInScreenState extends State<LogInScreen> {
String email;
String password;
final _formKey = GlobalKey<FormState>();
final _auth = AuthService();
@override
Widget build(BuildContext context) {
return Form(
key: _formKey,
// Main container which covers the whole screen
child: Container(
color: SamsungColor.black,
child: SafeArea(
child: Scaffold(
backgroundColor: SamsungColor.black,
// ListView widget that holds all the widgets in the screen
// including the two textfield and buttons
body: ListView(
children: [
// First container that holds the title of the screen
// which in this case is Registration
Container(
alignment: Alignment.topCenter,
margin: EdgeInsets.only(
top: 80.0,
bottom: 70.0,
right: 30.0,
left: 30.0,
),
child: Text(
"Log In",
style: TextStyle(
color: Colors.white,
fontSize: 45.0,
),
),
),
// Second container which holds the first email textfield
Container(
height: 50.0,
margin: EdgeInsets.all(10.0),
child: TextFormField(
validator: (typedEmail) =>
typedEmail.isEmpty ? "Enter an email." : null,
onChanged: (typedEmail) {
email = typedEmail;
},
textAlign: TextAlign.center,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(60.0),
borderSide: BorderSide.none,
),
fillColor: SamsungColor.lightGrey,
filled: true,
),
),
),
// Third container which holds the second pass textfield
Container(
height: 50.0,
margin: EdgeInsets.all(10.0),
child: TextFormField(
validator: (typedPass) => typedPass.length < 6
? "Enter the correct password."
: null,
onChanged: (typedPass) {
password = typedPass;
},
textAlignVertical: TextAlignVertical.center,
textAlign: TextAlign.center,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(60.0),
borderSide: BorderSide.none,
),
fillColor: SamsungColor.lightGrey,
filled: true,
),
),
),
// Fourth comes the login button
ElevatedButton(
onPressed: () async {
var result = await _auth.signIn(
email,
password,
);
if (result != null) {
print("sing in successful");
}
},
child: Text(
"Log In",
style: TextStyle(color: Colors.white),
),
),
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib | mirrored_repositories/OneSarkel/lib/screens/add_conversation.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/components/contact_tile.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/services/auth.dart';
import 'package:flutter_samsung_messaging_app_clone/services/database.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
final database = DatabaseService();
final auth = AuthService();
class AddConversation extends StatefulWidget {
@override
_AddConversationState createState() => _AddConversationState();
}
class _AddConversationState extends State<AddConversation> {
TextEditingController searchController = TextEditingController();
String query = "";
List<UserData> userList = List<UserData>();
searchAppBar(context) {
return AppBar(
elevation: 0.0,
backgroundColor: SamsungColor.black,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: SamsungColor.white,
onPressed: () {
Navigator.pop(context);
},
),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(kToolbarHeight + 21),
child: Padding(
padding: EdgeInsets.only(left: 20),
child: TextField(
controller: searchController,
onChanged: (typedQuery) {
setState(() {
query = typedQuery;
});
},
autofocus: true,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 35,
),
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Search",
hintStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 35,
color: Color(0x88ffffff),
),
suffixIcon: IconButton(
icon: Icon(Icons.clear, color: Colors.white),
onPressed: () {
WidgetsBinding.instance
.addPostFrameCallback((_) => searchController.clear());
},
),
),
),
),
),
);
}
generateSearchResults(String query) {
final List<UserData> searchUserList = query.isEmpty
? []
: userList.where((UserData user) {
String _getEmail = user.email.toLowerCase();
String _getUsername = user.username.toLowerCase();
String _query = query.toLowerCase();
bool matchedUsername = _getUsername.contains(_query);
bool matchedEmail = _getEmail.contains(_query);
return (matchedEmail || matchedUsername);
}).toList();
print(searchUserList.length);
return Container(
child: ListView.builder(
itemBuilder: (BuildContext context, int index) {
return ContactTile(
userData: searchUserList[index],
);
},
itemCount: searchUserList.length,
),
);
}
@override
void initState() {
super.initState();
auth.getCurrentUser().then((currentUser) {
database
.fetchUserCollection(currentUser)
.then((List<UserData> userCollection) {
setState(() {
userList = userCollection;
});
});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: searchAppBar(context),
body: Container(
color: SamsungColor.black,
padding: EdgeInsets.symmetric(horizontal: 20.0),
child: generateSearchResults(query),
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib/screens | mirrored_repositories/OneSarkel/lib/screens/auth/wrapper.dart | import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/screens/home/home_screen.dart';
import 'package:provider/provider.dart';
import 'auth_screen.dart';
class Wrapper extends StatefulWidget {
Wrapper({Key key}) : super(key: key);
@override
_WrapperState createState() => _WrapperState();
}
class _WrapperState extends State<Wrapper> {
@override
Widget build(BuildContext context) {
final user = Provider.of<CurrentUser>(context);
return user == null ? RegistrationScreen() : HomeScreen();
}
}
| 0 |
mirrored_repositories/OneSarkel/lib/screens | mirrored_repositories/OneSarkel/lib/screens/auth/auth_screen.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/services/auth.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
import 'package:modal_progress_hud/modal_progress_hud.dart';
class RegistrationScreen extends StatefulWidget {
RegistrationScreen({Key key}) : super(key: key);
@override
_RegistrationScreenState createState() => _RegistrationScreenState();
}
class _RegistrationScreenState extends State<RegistrationScreen> {
String _email;
String _pass;
AuthService _auth = AuthService();
final _formKey = GlobalKey<FormState>();
String warningMessage = "";
bool showLoading = false;
@override
Widget build(BuildContext context) {
// Main container which covers the whole screen
return Container(
color: SamsungColor.black,
child: SafeArea(
child: ModalProgressHUD(
inAsyncCall: showLoading,
child: Scaffold(
backgroundColor: SamsungColor.black,
body: Form(
key: _formKey,
// ListView widget that holds all the widgets in the screen
// including the two textfield and buttons
child: ListView(
children: [
// First container that holds the title of the screen
// which in this case is Registration
Container(
alignment: Alignment.topCenter,
margin: EdgeInsets.only(
top: 80.0,
bottom: 70.0,
right: 30.0,
left: 30.0,
),
child: Text(
"Register or Log In",
style: TextStyle(
color: Colors.white,
fontSize: 45.0,
),
),
),
// Second container which holds the first email textfield
Padding(
padding: EdgeInsets.all(10.0),
child: TextFormField(
style:
TextStyle(color: SamsungColor.white, fontSize: 20.0),
validator: (typedEmail) =>
typedEmail.isEmpty ? "Enter an email" : null,
onChanged: (typedEmail) {
setState(() {
_email = typedEmail;
});
},
textAlign: TextAlign.center,
decoration: textInPutDecoration(),
),
),
// Third container which holds the second pass textfield
Padding(
padding: EdgeInsets.all(10.0),
child: TextFormField(
obscureText: true,
style:
TextStyle(color: SamsungColor.white, fontSize: 20.0),
validator: (typedPassword) => typedPassword.length < 6
? 'Pass with at least 6 characters'
: null,
onChanged: (typedPassword) {
setState(() {
_pass = typedPassword;
});
},
textAlignVertical: TextAlignVertical.center,
textAlign: TextAlign.center,
decoration: textInPutDecoration(),
),
),
// Column that holds two buttons: registration and login
Column(
children: [
SizedBox(
height: 20.0,
),
// First button: registration button
SizedBox(
width: 200.0,
height: 50.0,
child: RaisedButton(
elevation: 0.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50.0),
),
onPressed: () async {
FocusScope.of(context).unfocus();
if (_formKey.currentState.validate()) {
setState(() {
showLoading = true;
});
await _auth
.register(_email, _pass)
.then((result) {
if (result != null) {
setState(() {
showLoading = false;
});
} else {
setState(() {
showLoading = false;
warningMessage =
"Try correcting the email or another email address";
});
}
});
}
},
child: Text(
"Registration",
style:
TextStyle(color: Colors.white, fontSize: 20.0),
),
color: SamsungColor.primaryDark,
),
),
// Second button: login button
SizedBox(
height: 20.0,
),
SizedBox(
width: 200.0,
height: 50.0,
child: RaisedButton(
child: Text(
"Log In",
style: TextStyle(
color: Colors.white, fontSize: 20.0),
),
color: SamsungColor.primaryDark,
elevation: 0.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50.0),
),
onPressed: () async {
FocusScope.of(context).unfocus();
if (_formKey.currentState.validate()) {
setState(() {
showLoading = true;
});
await _auth
.signIn(_email, _pass)
.then((result) {
if (result != null) {
} else {
setState(() {
showLoading = false;
});
}
});
}
}),
),
],
),
SizedBox(
height: 40.0,
),
WarningText(warningMessage: warningMessage),
],
),
),
),
),
),
);
}
InputDecoration textInPutDecoration() {
return InputDecoration(
errorStyle: TextStyle(
fontSize: 15.0,
color: SamsungColor.lightGrey,
),
contentPadding: EdgeInsets.all(20.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(60.0),
borderSide: BorderSide.none,
),
fillColor: SamsungColor.lightGrey,
filled: true,
);
}
}
class WarningText extends StatelessWidget {
const WarningText({
Key key,
@required this.warningMessage,
}) : super(key: key);
final String warningMessage;
@override
Widget build(BuildContext context) {
return Text(
warningMessage,
textAlign: TextAlign.center,
style: TextStyle(
color: SamsungColor.lightGrey,
fontWeight: FontWeight.bold,
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib/screens | mirrored_repositories/OneSarkel/lib/screens/home/home_screen.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/components/home_screen_nav_bar.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/screens/home/pages/contact_page.dart';
import 'package:flutter_samsung_messaging_app_clone/screens/home/pages/conversation_page.dart';
import 'package:flutter_samsung_messaging_app_clone/services/database.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
import 'package:provider/provider.dart';
class HomeScreen extends StatefulWidget {
HomeScreen({Key key}) : super(key: key);
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen>
with TickerProviderStateMixin<HomeScreen> {
PageController homeScreenPageController = PageController();
int _page = 0;
void navigationTapped(page) {
homeScreenPageController.animateToPage(
page,
duration: Duration(milliseconds: 400),
curve: Curves.easeInOut,
);
}
void onPageChanged(page) {
setState(() {
_page = page;
});
}
@override
Widget build(BuildContext context) {
return StreamProvider<List<UserData>>.value(
value: DatabaseService().userData,
catchError: (_, __) => null,
child: Container(
color: SamsungColor.black,
child: SafeArea(
child: Scaffold(
bottomNavigationBar: HomeScreenBottomNavBar(
page: _page,
navigationTapped: navigationTapped,
),
body: PageView(
controller: homeScreenPageController,
onPageChanged: onPageChanged,
children: [
ConversationPage(),
ContactPage(),
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib/screens/home | mirrored_repositories/OneSarkel/lib/screens/home/pages/contact_page.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter_samsung_messaging_app_clone/components/contact_tile.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
import 'package:provider/provider.dart';
class ContactPage extends StatefulWidget {
ContactPage({Key key}) : super(key: key);
@override
_ContactPageState createState() => _ContactPageState();
}
class _ContactPageState extends State<ContactPage> {
ScrollController _contactListController;
Alignment headerAlignment = Alignment.center;
EdgeInsets headerPadding = EdgeInsets.only(bottom: 90.0, top: 60.0);
double headerTextSize = 40.0;
final CollectionReference userCollection =
Firestore.instance.collection('users');
_scrollListener() {
if (_contactListController.offset >=
_contactListController.position.maxScrollExtent &&
!_contactListController.position.outOfRange) {
setState(() {
headerTextSize = 22.0;
headerAlignment = Alignment.topLeft;
headerPadding = EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 20.0,
);
print("reached bottom");
});
}
if (_contactListController.offset <=
_contactListController.position.minScrollExtent &&
!_contactListController.position.outOfRange) {
setState(
() {
headerTextSize = 40.0;
headerAlignment = Alignment.bottomCenter;
headerPadding = EdgeInsets.only(bottom: 90.0, top: 60.0);
print("reached top");
},
);
}
}
@override
void initState() {
super.initState();
_contactListController = ScrollController();
_contactListController.addListener(_scrollListener);
}
@override
void dispose() {
super.dispose();
_contactListController.dispose();
}
@override
Widget build(BuildContext context) {
final _users = Provider.of<List<UserData>>(context) ?? List<UserData>();
final currentUser = Provider.of<UserData>(context) ?? UserData();
//it removes current user from the list
_users.removeWhere((userData) {
return userData.uid == currentUser.uid;
});
return Scaffold(
backgroundColor: SamsungColor.black,
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: SizedBox(
height: 400.0,
child: ListView.builder(
controller: _contactListController,
itemCount: _users.length,
itemBuilder: (BuildContext context, int index) {
return ContactTile(
userData: _users[index],
);
},
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel/lib/screens/home | mirrored_repositories/OneSarkel/lib/screens/home/pages/conversation_page.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_samsung_messaging_app_clone/components/chat_tile.dart';
import 'package:flutter_samsung_messaging_app_clone/components/header_text.dart';
import 'package:flutter_samsung_messaging_app_clone/models/user.dart';
import 'package:flutter_samsung_messaging_app_clone/screens/add_conversation.dart';
import 'package:flutter_samsung_messaging_app_clone/services/auth.dart';
import 'package:flutter_samsung_messaging_app_clone/theme/samsung_color.dart';
import 'package:provider/provider.dart';
class ConversationPage extends StatefulWidget {
const ConversationPage({
Key key,
}) : super(key: key);
@override
_ConversationPageState createState() => _ConversationPageState();
}
class _ConversationPageState extends State<ConversationPage> {
// ScrollController _conversationListController;
Alignment headerAlignment = Alignment.center;
EdgeInsets headerPadding = EdgeInsets.only(bottom: 90.0, top: 60.0);
double headerTextSize = 40.0;
// _scrollListener() {
// if (_conversationListController.offset >=
// _conversationListController.position.maxScrollExtent &&
// !_conversationListController.position.outOfRange) {
// setState(() {
// headerTextSize = 22.0;
// headerAlignment = Alignment.topLeft;
// headerPadding = EdgeInsets.symmetric(
// vertical: 20.0,
// horizontal: 20.0,
// );
// print("reached bottom");
// });
// }
// if (_conversationListController.offset <=
// _conversationListController.position.minScrollExtent &&
// !_conversationListController.position.outOfRange) {
// setState(
// () {
// headerTextSize = 40.0;
// headerAlignment = Alignment.bottomCenter;
// headerPadding = EdgeInsets.only(bottom: 90.0, top: 60.0);
// print("reached top");
// },
// );
// }
// }
// @override
// void initState() {
// super.initState();
// _conversationListController = ScrollController();
// _conversationListController.addListener(_scrollListener);
// }
//
// @override
// void dispose() {
// super.dispose();
// _conversationListController.dispose();
// }
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
List<UserData> users = Provider.of<List<UserData>>(context) ?? [];
final currentUser = Provider.of<UserData>(context) ?? UserData();
void handleClick(String value) {
if (value == "Logout") {
AuthService().signOut();
} else if (value == "Settings") {
//TODO: settings will be here
}
}
return Scaffold(
appBar: AppBar(
backgroundColor: SamsungColor.black,
actions: [
PopupMenuButton<String>(
onSelected: handleClick,
itemBuilder: (BuildContext context) {
return {'Logout', 'Settings'}.map((String choice) {
return PopupMenuItem<String>(
value: choice,
child: Text(choice),
);
}).toList();
},
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () {
Navigator.of(context).push(CupertinoPageRoute(
builder: (BuildContext context) => AddConversation()));
},
backgroundColor: SamsungColor.primaryDark,
child: Icon(
Icons.message,
),
),
backgroundColor: SamsungColor.black,
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FutureBuilder<UserData>(
future: AuthService().getCurrentUser(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
return snapshot.hasData
? HeaderTextWidget(
headerAlignment: headerAlignment,
headerPadding: headerPadding,
headerTextSize: headerTextSize,
title: "Hi, ${snapshot.data.username}",
)
: HeaderTextWidget(
headerAlignment: headerAlignment,
headerPadding: headerPadding,
headerTextSize: headerTextSize,
title: "Please, wait, Mr(s)");
}),
Expanded(
child: SizedBox(
height: 400.0,
child: ListView.builder(
itemCount: users.length,
itemBuilder: (BuildContext context, int index) {
return ChatTile(
userData: users[index],
);
},
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/OneSarkel | mirrored_repositories/OneSarkel/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_samsung_messaging_app_clone/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/Flutterdev-static-web | mirrored_repositories/Flutterdev-static-web/lib/main.dart | import 'package:flutter/material.dart';
import 'package:port/const/const_colors.dart';
import 'package:port/ui/component/block.dart';
import 'package:port/ui/component/header.dart';
import 'package:port/ui/component/navbar.dart';
import 'package:port/ui/component/section1.dart';
import 'package:port/ui/component/section3.dart';
import 'package:port/ui/component/section4.dart';
import 'package:port/ui/component/section5.dart';
import 'package:responsive_framework/responsive_framework.dart';
void main() {
runApp(
HomePageDesign()
);
}
class HomePageDesign extends StatelessWidget {
const HomePageDesign({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
builder: (context, widget) => ResponsiveWrapper.builder(
ClampingScrollWrapper.builder(context, widget),
defaultScale: true,
minWidth: 480,
defaultName: MOBILE,
breakpoints: [
ResponsiveBreakpoint.autoScale(480, name: MOBILE),
ResponsiveBreakpoint.resize(600, name: MOBILE),
ResponsiveBreakpoint.resize(850, name: TABLET),
ResponsiveBreakpoint.resize(1080, name: DESKTOP),
],
background: Container(color: ConstColor.kbgColor)),
home: Scaffold(
backgroundColor: ConstColor.kbgColor,
appBar: PreferredSize(
preferredSize: Size(double.infinity, 66), child: NavBar()),
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: <Widget>[
ResponsiveWrapper(
maxWidth: 1200,
minWidth: 1200,
defaultScale: true,
mediaQueryData: MediaQueryData(size: Size(1200, 640)),
child: ResponsiveConstraints(child: Header())),
ResponsiveConstraints(
constraintsWhen: blockWidthConstraints, child: Section1()),
ResponsiveConstraints(
constraintsWhen: blockWidthConstraints, child: Section3()),
ResponsiveConstraints(
constraintsWhen: blockWidthConstraints, child: Section4()),
Footer()
],
),
),
),
debugShowCheckedModeBanner: false,
);
}
}
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.