repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib/screens/splash_screen.dart
import 'package:ecommerce_app_isaatech/constants/colors.dart'; import 'package:ecommerce_app_isaatech/constants/images.dart'; import 'package:ecommerce_app_isaatech/screens/login.dart'; import 'package:lottie/lottie.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:flutter/material.dart'; class SplashScreen extends StatefulWidget { static const String id = '/'; const SplashScreen({Key? key}) : super(key: key); @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> { void _navigateToNext() async { Future.delayed(const Duration(seconds: 2), () { Navigator.of(context).pushNamed(LoginScreen.id); }); } @override void initState() { super.initState(); _navigateToNext(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: CustomColors.customGrey, body: Center( child: TweenAnimationBuilder( curve: Curves.easeInOutBack, duration: const Duration(milliseconds: 1500), tween: Tween<double>( begin: 0, end: 1, ), builder: (context, val, child) => Material( color: CustomColors.halfWhite, elevation: 0, borderRadius: BorderRadius.circular(500), child: Lottie.asset( Images.splashAnim, frameRate: FrameRate(60), width: context.percentWidth * (double.parse(val.toString()) * 55), ), ), ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib/screens/signup.dart
import 'dart:ui'; import 'package:ecommerce_app_isaatech/components/blur_container.dart'; import 'package:ecommerce_app_isaatech/components/buttons.dart'; import 'package:ecommerce_app_isaatech/components/social_icon_buttons_row.dart'; import 'package:ecommerce_app_isaatech/components/textfields.dart'; import 'package:ecommerce_app_isaatech/constants/images.dart'; import 'package:ecommerce_app_isaatech/screens/home/main_home.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'package:velocity_x/velocity_x.dart'; class SignUpScreen extends StatefulWidget { static const String id = '/signup'; const SignUpScreen({Key? key}) : super(key: key); @override State<SignUpScreen> createState() => _SignUpScreenState(); } class _SignUpScreenState extends State<SignUpScreen> with SingleTickerProviderStateMixin { late AnimationController _blurAnimationController; @override void initState() { _blurAnimationController = AnimationController( vsync: this, duration: const Duration(seconds: 4), lowerBound: 0, upperBound: 45, ); super.initState(); _blurAnimationController.forward(); _blurAnimationController.addListener(() { setState(() {}); }); } @override void dispose() { super.dispose(); _blurAnimationController.dispose(); } @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Stack(children: [ Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage( Images.loginBg, ), fit: BoxFit.cover, )), ), BlurContainer(value: 50 - _blurAnimationController.value), SafeArea( child: Form( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ double.infinity.widthBox, const Spacer(), const Spacer(), _buildTitleText(context), const Spacer(), const PrimaryTextField( hintText: 'Name', prefixIcon: Icons.person, ), 24.heightBox, const PrimaryTextField( hintText: 'Password', isObscure: true, prefixIcon: CupertinoIcons.padlock, ), 24.heightBox, const PrimaryTextField( hintText: 'Email address', prefixIcon: CupertinoIcons.mail_solid, ), 24.heightBox, const PrimaryTextField( hintText: 'Phone', prefixIcon: CupertinoIcons.phone_fill, ), const Spacer(), AuthButton( text: 'Create', onPressed: () { Navigator.of(context).pushNamed(UserDashboard.id); }), const Spacer(), Text('Or create account using social media', style: TextStyle( fontSize: 15, color: Theme.of(context).colorScheme.onBackground)), 24.heightBox, const SocialIconButtonsRow(), ], ).p(24), ), ), ]), ); } Column _buildTitleText(BuildContext context) { return Column( children: [ Text( 'Create account', softWrap: true, style: Theme.of(context).textTheme.headline4!.copyWith( color: Theme.of(context).colorScheme.onBackground, fontWeight: FontWeight.w600), ), ], ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib/screens/product_page.dart
import 'package:dots_indicator/dots_indicator.dart'; import 'package:ecommerce_app_isaatech/components/rating_widget.dart'; import 'package:ecommerce_app_isaatech/constants/colors.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:velocity_x/velocity_x.dart'; import '../components/buttons.dart'; import '../models/product.dart'; class ProductPage extends StatefulWidget { static const String id = '/ProductPage'; const ProductPage({ Key? key, required this.product, }) : super(key: key); final Product product; @override State<ProductPage> createState() => _ProductPageState(); } class _ProductPageState extends State<ProductPage> { int _quantity = 1; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.product.name), actions: [ const BagButton( numberOfItemsPurchased: 3, ), 16.widthBox, ], ), body: Container( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Colors.white, Colors.grey.shade200], )), child: SingleChildScrollView( physics: const BouncingScrollPhysics(), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ MainProductPageProductCard( product: widget.product, ).px(24), 16.heightBox, Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ 'Description'.text.semiBold.lg.make(), const RatingWidget(rating: 4) ], ).px(24), widget.product.description.text.lg.make().py(12).px(24), Container( padding: const EdgeInsets.all(24), decoration: const BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(32), topRight: Radius.circular(32), ), ), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: 35, child: IconButton( padding: const EdgeInsets.all(0), onPressed: () { setState(() { if (_quantity > 1) _quantity -= 1; }); }, icon: const Icon( CupertinoIcons.minus_circle, size: 22, )), ), _quantity.text.xl.semiBold.make(), SizedBox( width: 35, child: IconButton( padding: const EdgeInsets.all(0), onPressed: () { setState(() { _quantity += 1; }); }, icon: const Icon( CupertinoIcons.plus_circle, size: 22, )), ), const Spacer(), 'Total: '.text.xl.make(), '\$${widget.product.price * _quantity}' .text .semiBold .xl .make(), ], ).px(8), 24.heightBox, PrimaryShadowedButton( child: 'Add to cart'.text.xl2.white.makeCentered().py(16), onPressed: () {}, borderRadius: 16, color: Colors.black) ], ), ), ], ), ), ), ); } } class MainProductPageProductCard extends StatefulWidget { const MainProductPageProductCard({ Key? key, required this.product, }) : super(key: key); final Product product; @override State<MainProductPageProductCard> createState() => _MainProductPageProductCardState(); } class _MainProductPageProductCardState extends State<MainProductPageProductCard> { int _selectedColor = 0; int _selectedImageIndex = 0; void _updateColor(int index) { setState(() { _selectedColor = index; }); } @override Widget build(BuildContext context) { return Stack( alignment: Alignment.bottomCenter, children: [ AspectRatio( aspectRatio: 0.75, child: Container( padding: const EdgeInsets.only(left: 12, right: 12, bottom: 12), margin: const EdgeInsets.only(top: 110, bottom: 16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.22), offset: const Offset(0, 16), spreadRadius: 1.5, blurRadius: 32), ]), child: Container( width: double.infinity, )), ), Column( mainAxisAlignment: MainAxisAlignment.end, children: [ AnimatedContainer( duration: const Duration(milliseconds: 300), decoration: BoxDecoration( color: widget.product.productColors[_selectedColor], borderRadius: BorderRadius.circular(24)), // margin: const EdgeInsets.only( // left: 25, right: 25, top: 24, bottom: 32), child: Stack( alignment: Alignment.bottomCenter, children: [ SizedBox( height: 340, child: PageView.builder( itemCount: widget.product.productImages.length, onPageChanged: (newIndex) => setState(() { _selectedImageIndex = newIndex; }), itemBuilder: (context, index) => AspectRatio( aspectRatio: 1, child: Image.asset( widget.product.productImages[_selectedImageIndex], ).p(24), ), ), ), Positioned( right: 12, top: 12, child: SizedBox( height: 35, width: 35, child: FavouriteButton( iconSize: 24, onPressed: () {}, ), ), ), Positioned( bottom: 10, child: DotsIndicator( dotsCount: 5, position: _selectedImageIndex.toDouble(), decorator: DotsDecorator( color: Colors.black12, spacing: const EdgeInsets.all(5), size: const Size.square(8.0), activeColor: Colors.black45, activeSize: const Size.square(8), activeShape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0)), ), )) ], ), ).p(24), Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: widget.product.name.text .size(24) .semiBold .maxLines(2) .softWrap(true) .make(), ), SizedBox( height: 40, width: 90, child: PrimaryShadowedButton( onPressed: () {}, child: '\$${widget.product.price}' .text .white .makeCentered(), borderRadius: 12, color: Colors.black, ), ) ], ), Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ ColorSelector( colors: widget.product.productColors, selectedIndex: _selectedColor, updateContainerColor: _updateColor, ), 'Size:'.text.gray500.make(), 8.widthBox, SizedBox( height: 32, width: 32, child: PrimaryShadowedButton( child: '9'.text.white.semiBold.makeCentered(), borderRadius: 500, color: CustomColors.darkBlue, onPressed: () {}, ), ), ], ), ], ).px(24).pOnly(bottom: 24) ], ), ], ); } } class ColorSelector extends StatelessWidget { const ColorSelector( {Key? key, required this.colors, required this.updateContainerColor, required this.selectedIndex}) : super(key: key); final List<Color> colors; final Function(int v) updateContainerColor; final int selectedIndex; @override Widget build(BuildContext context) { return Flexible( child: SizedBox( height: 60, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: colors.length, itemBuilder: (context, index) { return GestureDetector( onTap: () { updateContainerColor(index); }, child: AnimatedContainer( duration: const Duration(milliseconds: 300), decoration: BoxDecoration( color: (selectedIndex == index) ? CustomColors.darkBlue : Colors.transparent, shape: BoxShape.circle), child: Center( child: Container( width: 33, height: 33, decoration: BoxDecoration( shape: BoxShape.circle, color: colors[index], border: Border.all(width: 1.5, color: Colors.white)), ), ).p(1), ).pOnly(right: 3), ); }, ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib/screens
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib/screens/home/main_home.dart
import 'package:ecommerce_app_isaatech/constants/colors.dart'; import 'package:ecommerce_app_isaatech/screens/home/home_screens/home_screen.dart'; import 'package:ecommerce_app_isaatech/screens/profile_screen.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:velocity_x/velocity_x.dart'; import '../../components/bottom_bar_custom.dart'; import '../../components/buttons.dart'; import '../../constants/images.dart'; class UserDashboard extends StatefulWidget { static const String id = '/user-dashboard'; UserDashboard({ Key? key, this.child, }) : super(key: key); Widget? child; @override _UserDashboardState createState() => _UserDashboardState(); } class _UserDashboardState extends State<UserDashboard> with SingleTickerProviderStateMixin { bool isPlaying = false; bool isCollapsed = true; late double screenWidth, screenHeight; final Duration duration = const Duration(milliseconds: 300); late AnimationController _controller; late Animation<double> _scaleAnimation; late Animation<double> _menuScaleAnimation; late Animation<Offset> _slideAnimation; @override void initState() { _controller = AnimationController(vsync: this, duration: duration); _scaleAnimation = Tween<double>(begin: 1, end: 0.7).animate(_controller); _menuScaleAnimation = Tween<double>(begin: 0.5, end: 1).animate(_controller); _slideAnimation = Tween<Offset>(begin: const Offset(-1, 0), end: const Offset(0, 0)) .animate(_controller); super.initState(); if (widget.child == null) widget.child = MainScreen( child: Container(), toggleDrawer: toggleDrawer, ); WidgetsBinding.instance.addPostFrameCallback((_) {}); } @override void dispose() { _controller.dispose(); super.dispose(); } void toggleDrawer() { setState(() { if (isCollapsed) { _controller.forward(); } else { _controller.reverse(); } isCollapsed = !isCollapsed; }); } @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; screenHeight = size.height; screenWidth = size.width; return Scaffold( resizeToAvoidBottomInset: false, backgroundColor: CustomColors.customGrey, // floatingActionButton: (isCollapsed) // ? FloatingActionButton( // elevation: 1, // onPressed: toggleDrawer, // mini: true, // backgroundColor: CustomColors.customGrey, // child: const Icon(CupertinoIcons.sidebar_left), // ) // : const SizedBox(), body: !isCollapsed ? SafeArea( child: Stack( children: <Widget>[ menu(context), Dashboard( child: widget.child == null ? MainScreen(child: Container()) : widget.child!, duration: duration, isCollapsed: isCollapsed, scaleAnimation: _scaleAnimation, toggleDrawer: toggleDrawer, ), ], ), ) : Stack( children: [ menu(context), Dashboard( child: widget.child == null ? MainScreen(child: Container()) : widget.child!, duration: duration, isCollapsed: isCollapsed, scaleAnimation: _scaleAnimation, toggleDrawer: toggleDrawer, ), ], ), ); } Widget menu(BuildContext context) { return SlideTransition( position: _slideAnimation, child: ScaleTransition( scale: _menuScaleAnimation, child: Padding( padding: const EdgeInsets.only(left: 16.0, top: 48, bottom: 32), child: Align( alignment: Alignment.topLeft, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ // SvgPicture.asset(Images.logoWhite), MaterialButton( onPressed: () {}, highlightColor: CustomColors.customGrey, child: Text( 'Sign Out', style: dashboardButtonText, ), ).px(16) ], ), 48.heightBox, GestureDetector( onTap: () { setState(() {}); }, child: Row( children: [ GestureDetector( onTap: () { setState(() { // widget.child = _user == null // ? LoginScreen(isUser: true) // : ProfileScreen(); // toggleDrawer(); }); }, child: Card( elevation: 3, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(200)), child: const CircleAvatar( radius: 15, backgroundImage: AssetImage(Images.avatar), ), ), ), 16.widthBox, Text( 'Rashid Wassan', style: dashboardButtonText, ), 4.widthBox, true ? true ? Container( height: 15, width: 15, decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.blue), child: const Icon( Icons.check, size: 10, color: Colors.white, ), ) : const Icon( Icons.warning, color: Colors.white, size: 15, ) : const SizedBox.shrink() ], ), ), const Divider(), 8.heightBox, _dashboardSidebarButton( text: 'Discover', icon: CupertinoIcons.home, onTap: () { setState(() { widget.child = MainScreen( child: Container(), toggleDrawer: toggleDrawer, ); toggleDrawer(); }); }), const Divider(), _dashboardSidebarButton( text: 'Cart Items', icon: CupertinoIcons.list_number, onTap: () { setState(() { toggleDrawer(); }); }), const Divider(), _dashboardSidebarButton( text: 'Purchases', icon: CupertinoIcons.time, onTap: () {}, ), const Divider(), _dashboardSidebarButton( text: 'Seller Chats', icon: CupertinoIcons.chat_bubble, onTap: () {}), const Divider(), const Spacer(), Row( children: [ _dashboardSidebarButton( text: 'Settings', icon: CupertinoIcons.settings, onTap: () { setState(() { toggleDrawer(); }); }), 24.widthBox, ], ), const Spacer(), Row( children: [ // SvgPicture.asset( // Images.logoWhite, // height: 35, // ), 8.widthBox, Text( 'BazaarOnline', style: dashboardButtonText, ), ], ), 16.heightBox, Row( children: [ 4.widthBox, // SvgPicture.asset( // Images.settings, // ), 16.widthBox, Text( 'Report a complaint', style: dashboardButtonText.copyWith(fontSize: 14), ), ], ), ], ).pOnly(left: 8), ), ), ), ); } } class CustomDivider extends StatelessWidget { const CustomDivider({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const SizedBox( width: 180, child: Divider( color: Colors.white, height: 25, thickness: 0.5, indent: 48, ), ); } } Widget _dashboardSidebarButton( {required IconData icon, required String text, required Function() onTap}) { return Row( children: [ SizedBox( height: 35, width: 35, child: Icon( icon, color: Colors.white, ).p(7)), MaterialButton( elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), onPressed: onTap, child: Text(text, style: dashboardButtonText), ), ], ); } class Dashboard extends StatefulWidget { const Dashboard( {Key? key, required this.duration, required this.child, required this.isCollapsed, required this.scaleAnimation, required this.toggleDrawer}) : super(key: key); final Duration duration; final bool isCollapsed; final Animation<double> scaleAnimation; final Widget child; final Function() toggleDrawer; @override _DashboardState createState() => _DashboardState(); } class _DashboardState extends State<Dashboard> { @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; double screenWidth, screenHeight; screenHeight = size.height; screenWidth = size.width; return AnimatedPositioned( duration: widget.duration, top: 0, bottom: 0, left: widget.isCollapsed ? 0 : 0.5 * screenWidth, right: widget.isCollapsed ? 0 : -0.5 * screenWidth, child: ScaleTransition( scale: widget.scaleAnimation, child: widget.isCollapsed ? Stack(children: [ (widget.child == null) ? MainScreen( child: Container(), toggleDrawer: widget.toggleDrawer, ) : widget.child, SizedBox( width: 15, child: GestureDetector( onHorizontalDragEnd: (details) => widget.toggleDrawer, ), ) ]) : Stack(children: [ Container( margin: const EdgeInsets.only(top: 16), decoration: const BoxDecoration( color: Colors.white38, borderRadius: BorderRadius.only( topLeft: Radius.circular(20), bottomLeft: Radius.circular(20))), child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ double.infinity.widthBox, Row( mainAxisAlignment: MainAxisAlignment.start, children: [ 16.widthBox, MaterialButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8)), onPressed: () { setState(() { widget.toggleDrawer(); }); }, highlightColor: CustomColors.customGrey, child: Text( 'Back to browsing', style: dashboardButtonText, ), ), ], ), 16.heightBox, ], ), ), Material( elevation: 2, color: Colors.transparent, borderRadius: BorderRadius.circular(12), child: ClipRRect( borderRadius: BorderRadius.circular(12), child: widget.child), ).pOnly(left: 12, bottom: 70), ]), )); } } TextStyle dashboardButtonText = const TextStyle( fontSize: 18, fontWeight: FontWeight.w600, color: Colors.white); class MainScreen extends StatefulWidget { static const String id = '/homescreen'; const MainScreen({Key? key, required this.child, this.toggleDrawer}) : super(key: key); final Widget child; final Function()? toggleDrawer; @override _MainScreenState createState() => _MainScreenState(); } class _MainScreenState extends State<MainScreen> { late List<String> _titlesList; int _currentPage = 0; late List<Widget> _pages; updateCurrentPage(int newPage) { setState(() { _currentPage = newPage; }); } @override void initState() { _titlesList = ['Shoes', '1', '2', '3', 'Rashid Wassan']; _pages = [ const HomeScreen(), const Center(child: Text('2')), const Center(child: Text('3')), const Center(child: Text('4')), const UserProfileScreen(), ]; super.initState(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( leading: IconButton( icon: const Icon(Icons.menu_outlined), onPressed: widget.toggleDrawer, ), title: Text(_titlesList[_currentPage]), actions: [ const BagButton(), 16.widthBox, ], ), body: _pages[_currentPage], bottomNavigationBar: CustomNavigationBar( updatePage: updateCurrentPage, currentHomeScreen: _currentPage, ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib/screens/home
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/lib/screens/home/home_screens/home_screen.dart
import 'package:ecommerce_app_isaatech/components/rating_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:velocity_x/velocity_x.dart'; import '/components/buttons.dart'; import '/components/main_page_product_card.dart'; import '/constants/dummy_data.dart'; import '/constants/images.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({Key? key}) : super(key: key); @override _HomeScreenState createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { @override Widget build(BuildContext context) { return Column( children: [ const SearchBar(), 8.heightBox, const CategoriesCatalog(), const ProductPageView(), 12.heightBox, const MostPopularTitleText(), 12.heightBox, const PopularProductCard(), ], ).py(8); } } class MostPopularTitleText extends StatelessWidget { const MostPopularTitleText({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ 'Most Popular'.text.semiBold.xl2.make(), GestureDetector( onTap: () {}, child: 'View all'.text.underline.semiBold.make()), ], ).px(24); } } class PopularProductCard extends StatelessWidget { const PopularProductCard({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), offset: const Offset(0, 50), spreadRadius: 2, blurRadius: 124), ]), child: Row( children: [ Container( width: 75, height: 75, decoration: BoxDecoration( color: Colors.blue.shade100, borderRadius: BorderRadius.circular(12)), child: Image.asset(Images.sh2).p(8), ), 12.widthBox, Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ 'SB Zoom Blazer Low Pro'.text.lg.semiBold.make(), 'NIKE' .toUpperCase() .text .semiBold .color(Colors.grey) .softWrap(true) .make() .py(4), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ '\$80.00' .text .sm .semiBold .color(Colors.grey.shade700) .softWrap(true) .make(), 16.widthBox, const RatingWidget(rating: 5), ], ), ], ), const Spacer(), SizedBox( height: 35, width: 35, child: RoundedAddButton( onPressed: () {}, ), ), 12.widthBox, ], ).p(8), ).px(16); } } class ProductPageView extends StatefulWidget { const ProductPageView({Key? key}) : super(key: key); @override State<ProductPageView> createState() => _ProductPageViewState(); } class _ProductPageViewState extends State<ProductPageView> { int _currentPage = 0; @override Widget build(BuildContext context) { return Flexible( child: PageView.builder( controller: PageController(viewportFraction: 0.60, initialPage: 1), onPageChanged: (v) { setState(() { _currentPage = v; }); }, itemCount: products.length, itemBuilder: (context, index) { return HomeScreenProductCard( product: products[index], isCurrentInView: _currentPage == index, ); }), ); } } class SearchBar extends StatelessWidget { const SearchBar({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Row( children: [ Flexible( child: Container( height: 40, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Colors.grey.shade100, ), child: Row( children: [ Flexible( child: Row( children: [ const Icon(CupertinoIcons.search, color: Colors.grey) .px(16), const Flexible( child: TextField( decoration: InputDecoration(border: InputBorder.none), ), ), ], ), ), ], ), ), ), 16.widthBox, SizedBox( height: 40, width: 40, child: PrimaryShadowedButton( onPressed: () {}, child: Center( child: Icon(FontAwesomeIcons.slidersH, size: 18, color: Theme.of(context).colorScheme.surface), ), borderRadius: 12, color: Colors.black, ), ) ], ).px(24); } } class CategoriesCatalog extends StatefulWidget { const CategoriesCatalog({Key? key}) : super(key: key); @override _CategoriesCatalogState createState() => _CategoriesCatalogState(); } class _CategoriesCatalogState extends State<CategoriesCatalog> { int _selectedCategory = 1; @override Widget build(BuildContext context) { return SizedBox( height: 80, child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.horizontal, itemCount: 6, itemBuilder: (ctx, index) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), child: (index == 0) ? const SizedBox( width: 12, ) : (_selectedCategory == index) ? SizedBox( height: 47, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ PrimaryShadowedButton( child: Row( children: [ SizedBox( height: 47, width: 47, child: WhiteCategoryButton( updateCategory: () {}, ).p(5)), Text( 'Sneakers $index', style: const TextStyle( color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500), ).px(8), 12.widthBox, ], ), onPressed: () { setState(() { _selectedCategory = index; }); }, borderRadius: 80, color: Theme.of(context).colorScheme.onSurface), ], ), ) : WhiteCategoryButton( updateCategory: () { setState(() { _selectedCategory = index; }); }, ), ); }), ); } } class WhiteCategoryButton extends StatelessWidget { const WhiteCategoryButton({Key? key, required this.updateCategory}) : super(key: key); final Function() updateCategory; @override Widget build(BuildContext context) { return Container( width: 47, height: 47, decoration: BoxDecoration( color: Theme.of(context).colorScheme.surface, shape: BoxShape.circle, boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), spreadRadius: 1, blurRadius: 24) ]), child: InkWell( splashColor: Colors.transparent, highlightColor: Colors.transparent, onTap: updateCategory, child: SvgPicture.asset(Images.sneakers).p(10), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-ecommerce-app-ui/test/widget_test.dart
import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:ecommerce_app_isaatech/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const EcommerceAppIsaatech()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/main.dart
import 'package:flutter/material.dart'; import 'package:swiggy_ui/views/tab_desktop/tab_screen.dart'; import 'shared/app_theme.dart'; import 'views/tab_desktop/desktop_screen.dart'; import 'views/mobile/mobile_screen.dart'; import 'widgets/responsive.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( title: 'SwiggyUI', debugShowCheckedModeBanner: false, theme: appPrimaryTheme(), home: const Responsive( mobile: MobileScreen(), tablet: TabScreen(), desktop: DesktopScreen(), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/shared/app_theme.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:swiggy_ui/utils/app_colors.dart'; ThemeData appPrimaryTheme() => ThemeData( brightness: Brightness.light, primaryColor: Colors.white, scaffoldBackgroundColor: Colors.white, cardColor: Colors.white, snackBarTheme: const SnackBarThemeData( backgroundColor: appColor, contentTextStyle: TextStyle(color: Colors.white), actionTextColor: Colors.white, ), appBarTheme: const AppBarTheme( systemOverlayStyle: SystemUiOverlayStyle.light, color: Colors.white, elevation: 1.0, actionsIconTheme: IconThemeData( color: Colors.black, ), ), dividerColor: Colors.grey[300], dividerTheme: const DividerThemeData(thickness: 0.5), tabBarTheme: TabBarTheme( labelColor: Colors.black, unselectedLabelColor: Colors.grey, indicatorSize: TabBarIndicatorSize.tab, labelStyle: GoogleFonts.montserrat( fontSize: 12.0, fontWeight: FontWeight.w700, ), unselectedLabelStyle: GoogleFonts.montserrat( fontSize: 12.0, fontWeight: FontWeight.w500, ), ), textTheme: TextTheme( headline3: GoogleFonts.montserrat( fontSize: 42.0, fontWeight: FontWeight.bold, color: Colors.black, ), headline4: GoogleFonts.montserrat( fontSize: 25.0, fontWeight: FontWeight.bold, color: Colors.black, ), headline5: GoogleFonts.montserrat( fontSize: 24.0, fontWeight: FontWeight.w400, color: Colors.black, ), headline6: GoogleFonts.montserrat( fontSize: 20.0, fontWeight: FontWeight.w500, color: Colors.black, ), subtitle1: GoogleFonts.montserrat( fontSize: 16.0, fontWeight: FontWeight.w400, color: Colors.black, ), subtitle2: GoogleFonts.montserrat( fontSize: 14.0, fontWeight: FontWeight.w500, color: Colors.black, ), bodyText1: GoogleFonts.montserrat( fontSize: 15.0, fontWeight: FontWeight.w400, color: Colors.black, ), bodyText2: GoogleFonts.montserrat( fontSize: 12.0, fontWeight: FontWeight.w400, color: Colors.black, ), button: GoogleFonts.montserrat( fontSize: 16.0, fontWeight: FontWeight.w500, color: Colors.white, ), ), );
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/mobile_screen.dart
import 'package:flutter/material.dart'; import 'package:swiggy_ui/views/mobile/home_bottom_navigation_screen.dart'; class MobileScreen extends StatelessWidget { const MobileScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const HomeBottomNavigationScreen(); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/home_bottom_navigation_screen.dart
import 'package:flutter/material.dart'; import 'package:swiggy_ui/views/mobile/search/search_screen.dart'; import 'package:swiggy_ui/views/mobile/swiggy/swiggy_screen.dart'; import '../../utils/app_colors.dart'; import 'account/account_screen.dart'; import 'cart/cart_screen.dart'; class HomeBottomNavigationScreen extends StatefulWidget { const HomeBottomNavigationScreen({Key? key}) : super(key: key); @override _HomeBottomNavigationScreenState createState() => _HomeBottomNavigationScreenState(); } class _HomeBottomNavigationScreenState extends State<HomeBottomNavigationScreen> { final List<Widget> _children = [ const SwiggyScreen(), const SearchScreen(), const CartScreen(), AccountScreen(), ]; int selectedIndex = 0; @override Widget build(BuildContext context) { final labelTextStyle = Theme.of(context).textTheme.subtitle2!.copyWith(fontSize: 8.0); return Scaffold( body: _children[selectedIndex], bottomNavigationBar: SizedBox( height: 50.0, child: BottomNavigationBar( type: BottomNavigationBarType.fixed, selectedItemColor: darkOrange, unselectedItemColor: Colors.grey, currentIndex: selectedIndex, selectedLabelStyle: labelTextStyle, unselectedLabelStyle: labelTextStyle, onTap: (index) { setState(() { selectedIndex = index; }); }, items: const [ BottomNavigationBarItem( icon: Icon(Icons.home), label: 'SWIGGY', ), BottomNavigationBarItem( icon: Icon(Icons.search), label: 'SEARCH', ), BottomNavigationBarItem( icon: Icon(Icons.add_shopping_cart), label: 'CART', ), BottomNavigationBarItem( icon: Icon(Icons.person_outline), label: 'ACCOUNT', ), ], ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/cart/cart_screen.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/custom_divider_view.dart'; import 'package:swiggy_ui/widgets/veg_badge_view.dart'; class CartScreen extends StatelessWidget { const CartScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: SingleChildScrollView( child: Container( margin: const EdgeInsets.only(top: 15.0), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ _OrderView(), const CustomDividerView(dividerHeight: 15.0), _CouponView(), const CustomDividerView(dividerHeight: 15.0), _BillDetailView(), _DecoratedView(), _AddressPaymentView(), ], ), ), ), ), ); } } class _OrderView extends StatefulWidget { @override _OrderViewState createState() => _OrderViewState(); } class _OrderViewState extends State<_OrderView> { int cartCount = 1; @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.all(10.0), child: Column( children: <Widget>[ Row( children: <Widget>[ Image.asset( 'assets/images/food1.jpg', height: 60.0, width: 60.0, ), UIHelper.horizontalSpaceSmall(), Column( children: <Widget>[ Text("Anay's Resturant", style: Theme.of(context).textTheme.subtitle2), UIHelper.verticalSpaceExtraSmall(), Text('Wardha', style: Theme.of(context).textTheme.bodyText1) ], ) ], ), UIHelper.verticalSpaceLarge(), Row( children: <Widget>[ const VegBadgeView(), UIHelper.horizontalSpaceSmall(), Flexible( child: Text( 'Gazar ka Halwa', style: Theme.of(context).textTheme.bodyText1, ), ), UIHelper.horizontalSpaceSmall(), Container( padding: const EdgeInsets.symmetric(horizontal: 5.0), height: 35.0, width: 100.0, decoration: BoxDecoration( border: Border.all( color: Colors.grey, ), ), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ InkWell( child: const Icon(Icons.remove, color: Colors.green), onTap: () { if (cartCount > 0) { setState(() { cartCount -= 1; }); } }, ), const Spacer(), Text('$cartCount', style: Theme.of(context) .textTheme .subtitle2! .copyWith(fontSize: 16.0)), const Spacer(), InkWell( child: const Icon(Icons.add, color: Colors.green), onTap: () { setState(() { cartCount += 1; }); }, ) ], ), ), UIHelper.horizontalSpaceSmall(), Text( 'Rs45', style: Theme.of(context).textTheme.bodyText1, ), ], ), UIHelper.verticalSpaceExtraLarge(), CustomDividerView( dividerHeight: 1.0, color: Colors.grey[400], ), UIHelper.verticalSpaceMedium(), Row( children: <Widget>[ Icon(Icons.library_books, color: Colors.grey[700]), UIHelper.horizontalSpaceSmall(), const Expanded( child: Text( 'Any restaurant request? We will try our best to convey it'), ) ], ), UIHelper.verticalSpaceMedium(), ], ), ); } } class _CouponView extends StatelessWidget { @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.all(20.0), child: Row( children: <Widget>[ Icon(Icons.local_offer, size: 20.0, color: Colors.grey[700]), UIHelper.horizontalSpaceMedium(), Text( 'APPLY COUPON', style: Theme.of(context).textTheme.subtitle2!.copyWith(fontSize: 16.0), ), const Spacer(), const Icon(Icons.keyboard_arrow_right, color: Colors.grey), ], ), ); } } class _BillDetailView extends StatelessWidget { @override Widget build(BuildContext context) { final textStyle = Theme.of(context).textTheme.bodyText1!.copyWith(fontSize: 16.0); return Container( padding: const EdgeInsets.all(20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Bill Details', style: Theme.of(context).textTheme.headline6!.copyWith(fontSize: 17.0), ), UIHelper.verticalSpaceSmall(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Text('Item total', style: textStyle), Text('Rs 45.00', style: textStyle), ], ), UIHelper.verticalSpaceMedium(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Flexible( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: <Widget>[ Row( children: <Widget>[ Text('Delivery Fee', style: textStyle), UIHelper.horizontalSpaceSmall(), const Icon(Icons.info_outline, size: 14.0) ], ), UIHelper.verticalSpaceSmall(), Text( 'Your Delivery Partner is travelling long distance to deliver your order', style: Theme.of(context) .textTheme .bodyText1! .copyWith(fontSize: 13.0), ), ], ), ), Text('Rs 34.00', style: textStyle), ], ), UIHelper.verticalSpaceLarge(), _buildDivider(), Container( alignment: Alignment.center, height: 60.0, child: Row( children: <Widget>[ Text('Taxes and Charges', style: textStyle), UIHelper.horizontalSpaceSmall(), const Icon(Icons.info_outline, size: 14.0), const Spacer(), Text('Rs 16.67', style: textStyle), ], ), ), _buildDivider(), Container( alignment: Alignment.center, height: 60.0, child: Row( children: <Widget>[ Text('To Pay', style: Theme.of(context).textTheme.subtitle2), const Spacer(), Text('Rs 95.67', style: textStyle), ], ), ), ], ), ); } CustomDividerView _buildDivider() => CustomDividerView( dividerHeight: 1.0, color: Colors.grey[400], ); } class _DecoratedView extends StatelessWidget { @override Widget build(BuildContext context) { return Container( height: 100.0, color: Colors.grey[200], ); } } class _AddressPaymentView extends StatelessWidget { @override Widget build(BuildContext context) { return Column( children: <Widget>[ Container( height: 50.0, color: Colors.black, child: Row( children: <Widget>[ Icon(Icons.phone, color: Colors.yellow[800]), UIHelper.horizontalSpaceSmall(), Expanded( child: Text( 'Want your order left outside? Call delivery executive', style: Theme.of(context) .textTheme .bodyText1! .copyWith(color: Colors.white), ), ) ], ), ), Container( padding: const EdgeInsets.all(20.0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Stack( children: <Widget>[ Container( alignment: Alignment.center, height: 60.0, width: 60.0, decoration: BoxDecoration( border: Border.all( color: Colors.grey, width: 1.0, ), ), child: const Icon(Icons.add_location, size: 30.0), ), const Positioned( top: 0.0, right: 0.0, child: Icon( Icons.check_circle, color: Colors.green, ), ) ], ), UIHelper.horizontalSpaceMedium(), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Deliver to Other', style: Theme.of(context) .textTheme .subtitle2! .copyWith(fontSize: 16.0), ), Text( 'Nalwadi', style: Theme.of(context) .textTheme .bodyText1! .copyWith(color: Colors.grey), ), UIHelper.verticalSpaceSmall(), Text( '43 MINS', style: Theme.of(context).textTheme.subtitle2, ), ], ), ), InkWell( child: Text( 'ADD ADDRESS', style: Theme.of(context) .textTheme .subtitle2! .copyWith(color: darkOrange), ), onTap: () {}, ), UIHelper.verticalSpaceMedium(), ], ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Expanded( child: Container( padding: const EdgeInsets.all(10.0), color: Colors.grey[200], child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Rs 95.67', style: Theme.of(context) .textTheme .subtitle2! .copyWith(fontSize: 16.0), ), UIHelper.verticalSpaceExtraSmall(), Text( 'VIEW DETAIL BILL', style: Theme.of(context) .textTheme .subtitle2! .copyWith(color: Colors.blue, fontSize: 13.0), ), ], ), ), ), Expanded( child: Container( alignment: Alignment.center, padding: const EdgeInsets.all(10.0), color: Colors.green, height: 58.0, child: Text( 'PROCEED TO PAY', style: Theme.of(context) .textTheme .subtitle2! .copyWith(color: Colors.white), ), ), ) ], ) ], ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/account/account_screen.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/custom_divider_view.dart'; import 'package:swiggy_ui/widgets/dotted_seperator_view.dart'; class AccountScreen extends StatelessWidget { final List<String> titles = [ 'My Account', 'SUPER Expired', 'Swiggy Money', 'Help', ]; final List<String> body = [ 'Address, Payments, Favourties, Referrals & Offers', 'You had a great savings run. Get SUPER again', 'Balance & Transactions', 'FAQ & Links', ]; AccountScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ _AppBar(), ListView.builder( shrinkWrap: true, itemCount: titles.length, physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) => _ListItem( title: titles[index], body: body[index], isLastItem: (titles.length - 1) == index, ), ), Container( alignment: Alignment.centerLeft, padding: const EdgeInsets.only(left: 15.0), height: 50.0, color: Colors.grey[200], child: Text( 'PAST ORDERS', style: Theme.of(context) .textTheme .subtitle2! .copyWith(color: Colors.grey[700], fontSize: 12.0), ), ), _PastOrderListView(), ], ), ), ), ); } } class _AppBar extends StatelessWidget { @override Widget build(BuildContext context) { final subtitleStyle = Theme.of(context).textTheme.bodyText1; return Container( padding: const EdgeInsets.all(15.0), child: Column( children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Text( 'SUYASH', style: Theme.of(context) .textTheme .headline6! .copyWith(fontWeight: FontWeight.bold, fontSize: 18.0), ), InkWell( child: Text( 'EDIT', style: Theme.of(context) .textTheme .headline6! .copyWith(fontSize: 17.0, color: darkOrange), ), onTap: () {}, ) ], ), UIHelper.verticalSpaceSmall(), Row( children: <Widget>[ Text('9970889776', style: subtitleStyle), UIHelper.horizontalSpaceSmall(), ClipOval( child: Container( height: 3.0, width: 3.0, color: Colors.grey[700], ), ), UIHelper.horizontalSpaceSmall(), Text('[email protected]', style: subtitleStyle) ], ), UIHelper.verticalSpaceLarge(), const CustomDividerView( dividerHeight: 1.8, color: Colors.black, ) ], ), ); } } class _ListItem extends StatelessWidget { const _ListItem({ Key? key, required this.title, required this.body, this.isLastItem = false, }) : assert(title != '', body != ''), super(key: key); final String title; final String body; final bool isLastItem; @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Row( crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Expanded( child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( title, style: Theme.of(context) .textTheme .headline6! .copyWith(fontSize: 15.0), ), UIHelper.verticalSpaceExtraSmall(), Text( body, style: Theme.of(context) .textTheme .bodyText1! .copyWith(fontSize: 13.0, color: Colors.black), ), ], ), ), const Spacer(), UIHelper.horizontalSpaceSmall(), const Icon(Icons.keyboard_arrow_right) ], ), UIHelper.verticalSpaceLarge(), isLastItem ? const SizedBox() : const CustomDividerView( dividerHeight: 0.8, color: Colors.black26, ), ], ), ); } } class _PastOrderListView extends StatelessWidget { final List<String> restaurants = [ 'Food Feast', 'Hangout', 'Gulshan Restaurant', ]; final List<String> foods = [ 'Panner Butter Masala x 1', 'Chicken Curry x 1', 'Curd x 1', ]; @override Widget build(BuildContext context) { return Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ ListView.builder( shrinkWrap: true, itemCount: restaurants.length, physics: const NeverScrollableScrollPhysics(), itemBuilder: (context, index) => _PastOrdersListItemView( restaurant: restaurants[index], foodItem: foods[index], ), ), TextButton( child: Text( 'VIEW MORE ORDERS', style: Theme.of(context) .textTheme .subtitle2! .copyWith(color: darkOrange), ), onPressed: () {}, ), UIHelper.verticalSpaceSmall(), const CustomDividerView(), Row( children: <Widget>[ Container( alignment: Alignment.centerLeft, padding: const EdgeInsets.only(left: 10.0), height: 50.0, child: Text( 'LOGOUT', style: Theme.of(context) .textTheme .subtitle2! .copyWith(fontSize: 16.0), ), ), const Spacer(), const Icon(Icons.power_settings_new), UIHelper.horizontalSpaceSmall(), ], ), Container( alignment: Alignment.topCenter, padding: const EdgeInsets.only(top: 20.0), height: 130.0, color: Colors.grey[200], child: Text( 'App Version v3.2.0', style: Theme.of(context) .textTheme .bodyText1! .copyWith(color: Colors.grey[700], fontSize: 13.0), ), ) ], ); } } class _PastOrdersListItemView extends StatelessWidget { const _PastOrdersListItemView({ Key? key, required this.restaurant, required this.foodItem, }) : assert(restaurant != '', foodItem != ''), super(key: key); final String restaurant; final String foodItem; @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( padding: const EdgeInsets.symmetric(vertical: 10.0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( restaurant, style: Theme.of(context).textTheme.subtitle2, ), UIHelper.verticalSpaceExtraSmall(), Text( 'Medavakkam', style: Theme.of(context) .textTheme .bodyText1! .copyWith(fontSize: 12.0), ), UIHelper.verticalSpaceSmall(), Row( children: <Widget>[ const Text('Rs112'), UIHelper.horizontalSpaceExtraSmall(), Icon(Icons.keyboard_arrow_right, color: Colors.grey[600]) ], ) ], ), const Spacer(), Text('Delivered', style: Theme.of(context).textTheme.subtitle2), UIHelper.horizontalSpaceSmall(), ClipOval( child: Container( padding: const EdgeInsets.all(2.2), color: Colors.green, child: const Icon(Icons.check, color: Colors.white, size: 14.0), ), ) ], ), ), UIHelper.verticalSpaceSmall(), const DottedSeperatorView(), UIHelper.verticalSpaceMedium(), Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text(foodItem), UIHelper.verticalSpaceExtraSmall(), const Text('October 08, 2:11 AM'), UIHelper.verticalSpaceSmall(), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ OutlinedButton( style: OutlinedButton.styleFrom( side: BorderSide(width: 1.5, color: darkOrange!), ), child: Text( 'REORDER', style: Theme.of(context) .textTheme .subtitle2! .copyWith(color: darkOrange), ), onPressed: () {}, ), UIHelper.verticalSpaceMedium(), const Text( 'Delivery rating not\napplicable for this order', maxLines: 2, ) ], ), ), UIHelper.horizontalSpaceMedium(), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ OutlinedButton( style: OutlinedButton.styleFrom( side: const BorderSide( width: 1.5, color: Colors.black, ), ), child: Text( 'RATE FOOD', style: Theme.of(context) .textTheme .subtitle2! .copyWith(color: Colors.black), ), onPressed: () {}, ), UIHelper.verticalSpaceMedium(), const Text("You haven't rated\nthis food yet") ], ), ) ], ), UIHelper.verticalSpaceMedium(), const CustomDividerView(dividerHeight: 1.5, color: Colors.black) ], ) ], ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy/top_picks_for_you_view.dart
import 'package:flutter/material.dart'; import 'package:swiggy_ui/models/top_picks_food.dart'; import 'package:swiggy_ui/utils/ui_helper.dart'; import 'package:swiggy_ui/views/mobile/swiggy/restaurants/restaurant_detail_screen.dart'; class TopPicksForYouView extends StatelessWidget { final foods = TopPicksFood.getTopPicksfoods(); TopPicksForYouView({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.all(15.0), child: Column( children: <Widget>[ Row( children: <Widget>[ const Icon(Icons.thumb_up, size: 20.0), UIHelper.horizontalSpaceSmall(), Text( 'Top Picks For You', style: Theme.of(context) .textTheme .headline4! .copyWith(fontSize: 20.0), ) ], ), UIHelper.verticalSpaceLarge(), LimitedBox( maxHeight: 188.0, child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.horizontal, itemCount: foods.length, itemBuilder: (context, index) => InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const RestaurantDetailScreen(), ), ); }, child: Container( margin: const EdgeInsets.all(10.0), width: 100.0, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(10.0), boxShadow: const <BoxShadow>[ BoxShadow( color: Colors.grey, blurRadius: 2.0, ) ], ), child: Image.asset( foods[index].image, width: 100.0, height: 100.0, fit: BoxFit.cover, ), ), UIHelper.verticalSpaceSmall(), Flexible( child: Text( foods[index].name, maxLines: 2, style: Theme.of(context).textTheme.subtitle2!.copyWith( fontSize: 14.0, fontWeight: FontWeight.w600, ), ), ), UIHelper.verticalSpaceExtraSmall(), Text( foods[index].minutes, maxLines: 1, style: Theme.of(context).textTheme.bodyText1!.copyWith( color: Colors.grey[700], fontSize: 13.0, ), ) ], ), ), ), ), ) ], ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile/swiggy
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views/mobile
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/views
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/widgets
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/widgets
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/widgets
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/models
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib/models
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Swiggy UI Clone/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/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/basic_shapes
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/basic_shapes/lib/main.dart
import 'package:basic_shapes/views/home.dart'; import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( title: 'Flutter Basic Shapes', debugShowCheckedModeBanner: false, home: Home(), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/basic_shapes/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/basic_shapes/lib/views/home.dart
import 'package:flutter/material.dart'; import 'dart:math'; class Home extends StatefulWidget { const Home({Key? key}) : super(key: key); @override State<Home> createState() => _HomeState(); } class _HomeState extends State<Home> { int choice = 3; double size = 100; Color selectedColor = Colors.indigo; Widget colouredCircle(Color color) { return Container( width: 24, decoration: BoxDecoration(color: color, shape: BoxShape.circle), ); } Widget shapeButton(int position) { Color currentColor = (choice == position) ? (selectedColor == Colors.white) ? Colors.black : Colors.white : Colors.grey; return InkWell( onTap: () { setState(() { choice = position; }); }, child: CustomPaint( size: const Size(24, 24), foregroundPainter: (position == 0) ? LineCustomPainter(currentColor) : (position == 1) ? TriangleCustomPainter(currentColor) : (position == 2) ? RectangleCustomPainter(currentColor) : (position == 3) ? SquareCustomPainter(currentColor) : (position == 4) ? CircleCustomPainter(currentColor) : (position == 5) ? PentagonCustomPainter(currentColor) : HexagonCustomPainter(currentColor), ), ); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: selectedColor == Colors.white ? const Color(0xFF1F1F1F) : Colors.white, body: SafeArea( child: LayoutBuilder(builder: (context, constraints) { double maxSliderValue = (constraints.maxWidth > constraints.maxHeight) ? constraints.maxHeight - 115 : constraints.maxWidth; if (size >= maxSliderValue && maxSliderValue != 0) { size = maxSliderValue; } return Column( children: [ Flexible( child: Center( child: CustomPaint( size: Size(size, size), willChange: true, foregroundPainter: (choice == 0) ? LineCustomPainter(selectedColor) : (choice == 1) ? TriangleCustomPainter(selectedColor) : (choice == 2) ? RectangleCustomPainter(selectedColor) : (choice == 3) ? SquareCustomPainter(selectedColor) : (choice == 4) ? CircleCustomPainter(selectedColor) : (choice == 5) ? PentagonCustomPainter( selectedColor) : HexagonCustomPainter( selectedColor), ), ), ), Container( width: double.infinity, color: selectedColor, padding: const EdgeInsets.only(top: 20, bottom: 10), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ shapeButton(0), shapeButton(1), shapeButton(2), shapeButton(3), shapeButton(4), shapeButton(5), shapeButton(6), ], ), const SizedBox(height: 10), Row( children: [ Container( padding: const EdgeInsets.all(8), margin: const EdgeInsets.only(left: 8), decoration: BoxDecoration( color: (selectedColor == Colors.white) ? Colors.black.withOpacity(0.2) : Colors.white.withOpacity(0.2), border: Border.all(color: Colors.grey), borderRadius: BorderRadius.circular(10), ), child: DropdownButtonHideUnderline( child: DropdownButton<Color>( value: selectedColor, iconEnabledColor: Colors.grey, dropdownColor: Colors.white.withOpacity(0.5), isDense: true, borderRadius: BorderRadius.circular(10), onChanged: (val) { setState(() { selectedColor = val ?? Colors.indigo; }); }, items: [ DropdownMenuItem( value: Colors.white, child: colouredCircle(Colors.white), ), DropdownMenuItem( value: Colors.pink, child: colouredCircle(Colors.pink), ), DropdownMenuItem( value: Colors.red, child: colouredCircle(Colors.red), ), DropdownMenuItem( value: Colors.amber, child: colouredCircle(Colors.amber), ), DropdownMenuItem( value: Colors.orange, child: colouredCircle(Colors.orange), ), DropdownMenuItem( value: Colors.lime, child: colouredCircle(Colors.lime), ), DropdownMenuItem( value: Colors.green, child: colouredCircle(Colors.green), ), DropdownMenuItem( value: Colors.teal, child: colouredCircle(Colors.teal), ), DropdownMenuItem( value: Colors.lightBlueAccent, child: colouredCircle(Colors.lightBlueAccent), ), DropdownMenuItem( value: Colors.blueAccent, child: colouredCircle(Colors.blueAccent), ), DropdownMenuItem( value: Colors.indigo, child: colouredCircle(Colors.indigo), ), DropdownMenuItem( value: Colors.deepPurple, child: colouredCircle(Colors.deepPurple), ), DropdownMenuItem( value: Colors.brown, child: colouredCircle(Colors.brown), ), DropdownMenuItem( value: Colors.black, child: colouredCircle(Colors.black), ), ], ), ), ), Expanded( child: Slider.adaptive( min: 24, max: maxSliderValue, value: size, activeColor: (selectedColor == Colors.white) ? Colors.black : Colors.white, inactiveColor: Colors.grey, thumbColor: (selectedColor == Colors.white) ? Colors.black : Colors.white, onChanged: (val) { setState( () { size = val; }, ); }, ), ), ], ), ], ), ), ], ); }), ), ); } } class LineCustomPainter extends CustomPainter { final Color color; LineCustomPainter(this.color); @override void paint(Canvas canvas, Size size) { var paint = Paint() ..color = color ..strokeWidth = 5; canvas.drawLine(Offset(0, size.height), Offset(size.width, 0), paint); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) { return true; } } class TriangleCustomPainter extends CustomPainter { final Color color; TriangleCustomPainter(this.color); @override void paint(Canvas canvas, Size size) { var paint = Paint()..color = color; var path = Path(); path.moveTo(size.width / 2, 0); path.lineTo(size.width, size.height); path.lineTo(0, size.height); path.lineTo(size.width / 2, 0); path.close(); canvas.drawPath(path, paint); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) { return true; } } class SquareCustomPainter extends CustomPainter { final Color color; SquareCustomPainter(this.color); @override void paint(Canvas canvas, Size size) { var paint = Paint()..color = color; canvas.drawRect( Rect.fromCenter( center: Offset(size.width / 2, size.height / 2), width: size.width, height: size.height), paint); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) { return true; } } class RectangleCustomPainter extends CustomPainter { final Color color; RectangleCustomPainter(this.color); @override void paint(Canvas canvas, Size size) { var paint = Paint()..color = color; canvas.drawRect( Rect.fromCenter( center: Offset(size.width / 2, size.height / 2), width: size.width, height: size.height / 2), paint); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) { return true; } } class CircleCustomPainter extends CustomPainter { final Color color; final PaintingStyle style; CircleCustomPainter(this.color, {this.style = PaintingStyle.fill}); @override void paint(Canvas canvas, Size size) { Paint paint = Paint() ..color = color ..strokeWidth = 5 ..style = style; canvas.drawCircle( Offset(size.width / 2, size.height / 2), size.width / 2, paint); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) { return true; } } class PentagonCustomPainter extends CustomPainter { final Color color; double _angleToRadian(double angle) { return angle * (pi / 180); } Offset _getOffset(double angle, double radius) { final rotationAwareAngle = angle - 90; final radian = _angleToRadian(rotationAwareAngle); final x = cos(radian) * radius + radius; final y = sin(radian) * radius + radius; return Offset(x, y); } PentagonCustomPainter(this.color); @override void paint(Canvas canvas, Size size) { final radius = size.width / 2; var paint = Paint()..color = color; var path = Path(); Offset current = _getOffset(72, radius); path.moveTo(current.dx, current.dy); current = _getOffset(144, radius); path.lineTo(current.dx, current.dy); current = _getOffset(216, radius); path.lineTo(current.dx, current.dy); current = _getOffset(288, radius); path.lineTo(current.dx, current.dy); current = _getOffset(361, radius); path.lineTo(current.dx, current.dy); canvas.drawPath(path, paint); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) { return true; } } class HexagonCustomPainter extends CustomPainter { final Color color; double _angleToRadian(double angle) { return angle * (pi / 180); } Offset _getOffset(double angle, double radius) { final rotationAwareAngle = angle - 90; final radian = _angleToRadian(rotationAwareAngle); final x = cos(radian) * radius + radius; final y = sin(radian) * radius + radius; return Offset(x, y); } HexagonCustomPainter(this.color); @override void paint(Canvas canvas, Size size) { final radius = size.width / 2; var paint = Paint()..color = color; var path = Path(); Offset current = _getOffset(60, radius); path.moveTo(current.dx, current.dy); current = _getOffset(120, radius); path.lineTo(current.dx, current.dy); current = _getOffset(180, radius); path.lineTo(current.dx, current.dy); current = _getOffset(240, radius); path.lineTo(current.dx, current.dy); current = _getOffset(300, radius); path.lineTo(current.dx, current.dy); current = _getOffset(360, radius); path.lineTo(current.dx, current.dy); canvas.drawPath(path, paint); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) { return true; } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/main.dart
import 'package:flutter/material.dart'; import 'package:notes/services/sharedPref.dart'; import 'screens/home.dart'; import 'data/theme.dart'; void main() => runApp(MyApp()); class MyApp extends StatefulWidget { // This widget is the root of your application. @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { ThemeData theme = appThemeLight; @override void initState() { super.initState(); updateThemeFromSharedPref(); } @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: theme, home: MyHomePage(title: 'Home', changeTheme: setTheme), ); } setTheme(Brightness brightness) { if (brightness == Brightness.dark) { setState(() { theme = appThemeDark; }); } else { setState(() { theme = appThemeLight; }); } } void updateThemeFromSharedPref() async { String themeText = await getThemeFromSharedPref(); if (themeText == 'light') { setTheme(Brightness.light); } else { setTheme(Brightness.dark); } } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/components/faderoute.dart
import 'package:flutter/material.dart'; class FadeRoute extends PageRouteBuilder { final Widget page; FadeRoute({this.page}) : super( pageBuilder: ( BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, ) => page, transitionsBuilder: ( BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child, ) => FadeTransition( opacity: animation, child: child, ), ); }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/components/cards.dart
import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import '../data/models.dart'; List<Color> colorList = [ Colors.blue, Colors.green, Colors.indigo, Colors.red, Colors.cyan, Colors.teal, Colors.amber.shade900, Colors.deepOrange ]; class NoteCardComponent extends StatelessWidget { const NoteCardComponent({ this.noteData, this.onTapAction, Key key, }) : super(key: key); final NotesModel noteData; final Function(NotesModel noteData) onTapAction; @override Widget build(BuildContext context) { String neatDate = DateFormat.yMd().add_jm().format(noteData.date); Color color = colorList.elementAt(noteData.title.length % colorList.length); return Container( margin: EdgeInsets.fromLTRB(10, 8, 10, 8), height: 110, decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), boxShadow: [buildBoxShadow(color, context)], ), child: Material( borderRadius: BorderRadius.circular(16), clipBehavior: Clip.antiAlias, color: Theme.of(context).dialogBackgroundColor, child: InkWell( borderRadius: BorderRadius.circular(16), onTap: () { onTapAction(noteData); }, splashColor: color.withAlpha(20), highlightColor: color.withAlpha(10), child: Container( padding: EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( '${noteData.title.trim().length <= 20 ? noteData.title.trim() : noteData.title.trim().substring(0, 20) + '...'}', style: TextStyle( fontFamily: 'ZillaSlab', fontSize: 20, fontWeight: noteData.isImportant ? FontWeight.w800 : FontWeight.normal), ), Container( margin: EdgeInsets.only(top: 8), child: Text( '${noteData.content.trim().split('\n').first.length <= 30 ? noteData.content.trim().split('\n').first : noteData.content.trim().split('\n').first.substring(0, 30) + '...'}', style: TextStyle(fontSize: 14, color: Colors.grey.shade400), ), ), Container( margin: EdgeInsets.only(top: 14), alignment: Alignment.centerRight, child: Row( children: <Widget>[ Icon(Icons.flag, size: 16, color: noteData.isImportant ? color : Colors.transparent), Spacer(), Text( '$neatDate', textAlign: TextAlign.right, style: TextStyle( fontSize: 12, color: Colors.grey.shade300, fontWeight: FontWeight.w500), ), ], ), ) ], ), ), ), )); } BoxShadow buildBoxShadow(Color color, BuildContext context) { if (Theme.of(context).brightness == Brightness.dark) { return BoxShadow( color: noteData.isImportant == true ? Colors.black.withAlpha(100) : Colors.black.withAlpha(10), blurRadius: 8, offset: Offset(0, 8)); } return BoxShadow( color: noteData.isImportant == true ? color.withAlpha(60) : color.withAlpha(25), blurRadius: 8, offset: Offset(0, 8)); } } class AddNoteCardComponent extends StatelessWidget { const AddNoteCardComponent({ Key key, }) : super(key: key); @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.fromLTRB(10, 8, 10, 8), height: 110, decoration: BoxDecoration( border: Border.all(color: Theme.of(context).primaryColor, width: 2), borderRadius: BorderRadius.circular(16), ), child: Material( borderRadius: BorderRadius.circular(16), clipBehavior: Clip.antiAlias, child: Container( padding: EdgeInsets.all(16), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Icon( Icons.add, color: Theme.of(context).primaryColor, ), Padding( padding: const EdgeInsets.all(8.0), child: Text( 'Add new note', style: TextStyle( fontFamily: 'ZillaSlab', color: Theme.of(context).primaryColor, fontSize: 20), )) ], ), ) ], ), ), )); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/data/theme.dart
import 'package:flutter/material.dart'; Color primaryColor = Color.fromARGB(255, 58, 149, 255); Color reallyLightGrey = Colors.grey.withAlpha(25); ThemeData appThemeLight = ThemeData.light().copyWith(primaryColor: primaryColor); ThemeData appThemeDark = ThemeData.dark().copyWith( primaryColor: Colors.white, toggleableActiveColor: primaryColor, accentColor: primaryColor, buttonColor: primaryColor, textSelectionColor: primaryColor, textSelectionHandleColor: primaryColor);
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/data/models.dart
import 'dart:math'; class NotesModel { int id; String title; String content; bool isImportant; DateTime date; NotesModel({this.id, this.title, this.content, this.isImportant, this.date}); NotesModel.fromMap(Map<String, dynamic> map) { this.id = map['_id']; this.title = map['title']; this.content = map['content']; this.date = DateTime.parse(map['date']); this.isImportant = map['isImportant'] == 1 ? true : false; } Map<String, dynamic> toMap() { return <String, dynamic>{ '_id': this.id, 'title': this.title, 'content': this.content, 'isImportant': this.isImportant == true ? 1 : 0, 'date': this.date.toIso8601String() }; } NotesModel.random() { this.id = Random(10).nextInt(1000) + 1; this.title = 'Lorem Ipsum ' * (Random().nextInt(4) + 1); this.content = 'Lorem Ipsum ' * (Random().nextInt(4) + 1); this.isImportant = Random().nextBool(); this.date = DateTime.now().add(Duration(hours: Random().nextInt(100))); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/services/database.dart
import 'package:path/path.dart'; import 'package:sqflite/sqflite.dart'; import '../data/models.dart'; class NotesDatabaseService { String path; NotesDatabaseService._(); static final NotesDatabaseService db = NotesDatabaseService._(); Database _database; Future<Database> get database async { if (_database != null) return _database; // if _database is null we instantiate it _database = await init(); return _database; } init() async { String path = await getDatabasesPath(); path = join(path, 'notes.db'); print("Entered path $path"); return await openDatabase(path, version: 1, onCreate: (Database db, int version) async { await db.execute( 'CREATE TABLE Notes (_id INTEGER PRIMARY KEY, title TEXT, content TEXT, date TEXT, isImportant INTEGER);'); print('New table created at $path'); }); } Future<List<NotesModel>> getNotesFromDB() async { final db = await database; List<NotesModel> notesList = []; List<Map> maps = await db.query('Notes', columns: ['_id', 'title', 'content', 'date', 'isImportant']); if (maps.length > 0) { maps.forEach((map) { notesList.add(NotesModel.fromMap(map)); }); } return notesList; } updateNoteInDB(NotesModel updatedNote) async { final db = await database; await db.update('Notes', updatedNote.toMap(), where: '_id = ?', whereArgs: [updatedNote.id]); print('Note updated: ${updatedNote.title} ${updatedNote.content}'); } deleteNoteInDB(NotesModel noteToDelete) async { final db = await database; await db.delete('Notes', where: '_id = ?', whereArgs: [noteToDelete.id]); print('Note deleted'); } Future<NotesModel> addNoteInDB(NotesModel newNote) async { final db = await database; if (newNote.title.trim().isEmpty) newNote.title = 'Untitled Note'; int id = await db.transaction((transaction) { transaction.rawInsert( 'INSERT into Notes(title, content, date, isImportant) VALUES ("${newNote.title}", "${newNote.content}", "${newNote.date.toIso8601String()}", ${newNote.isImportant == true ? 1 : 0});'); }); newNote.id = id; print('Note added: ${newNote.title} ${newNote.content}'); return newNote; } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/services/sharedPref.dart
import 'package:shared_preferences/shared_preferences.dart'; Future<String> getThemeFromSharedPref() async { SharedPreferences sharedPref = await SharedPreferences.getInstance(); return sharedPref.getString('theme'); } void setThemeinSharedPref(String val) async { SharedPreferences sharedPref = await SharedPreferences.getInstance(); sharedPref.setString('theme', val); }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/screens/view.dart
import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; import 'package:flutter/widgets.dart'; import 'package:intl/intl.dart'; import 'package:notes/data/models.dart'; import 'package:notes/screens/edit.dart'; import 'package:notes/services/database.dart'; import 'package:outline_material_icons/outline_material_icons.dart'; import 'package:share/share.dart'; class ViewNotePage extends StatefulWidget { Function() triggerRefetch; NotesModel currentNote; ViewNotePage({Key key, Function() triggerRefetch, NotesModel currentNote}) : super(key: key) { this.triggerRefetch = triggerRefetch; this.currentNote = currentNote; } @override _ViewNotePageState createState() => _ViewNotePageState(); } class _ViewNotePageState extends State<ViewNotePage> { @override void initState() { super.initState(); showHeader(); } void showHeader() async { Future.delayed(Duration(milliseconds: 100), () { setState(() { headerShouldShow = true; }); }); } bool headerShouldShow = false; @override Widget build(BuildContext context) { return Scaffold( body: Stack( children: <Widget>[ ListView( physics: BouncingScrollPhysics(), children: <Widget>[ Container( height: 40, ), Padding( padding: const EdgeInsets.only( left: 24.0, right: 24.0, top: 40.0, bottom: 16), child: AnimatedOpacity( opacity: headerShouldShow ? 1 : 0, duration: Duration(milliseconds: 200), curve: Curves.easeIn, child: Text( widget.currentNote.title, style: TextStyle( fontFamily: 'ZillaSlab', fontWeight: FontWeight.w700, fontSize: 36, ), overflow: TextOverflow.visible, softWrap: true, ), ), ), AnimatedOpacity( duration: Duration(milliseconds: 500), opacity: headerShouldShow ? 1 : 0, child: Padding( padding: const EdgeInsets.only(left: 24), child: Text( DateFormat.yMd().add_jm().format(widget.currentNote.date), style: TextStyle( fontWeight: FontWeight.w500, color: Colors.grey.shade500), ), ), ), Padding( padding: const EdgeInsets.only( left: 24.0, top: 36, bottom: 24, right: 24), child: Text( widget.currentNote.content, style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500), ), ) ], ), ClipRect( child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20), child: Container( height: 80, color: Theme.of(context).canvasColor.withOpacity(0.3), child: SafeArea( child: Row( children: <Widget>[ IconButton( icon: Icon(Icons.arrow_back), onPressed: handleBack, ), Spacer(), IconButton( icon: Icon(widget.currentNote.isImportant ? Icons.flag : Icons.outlined_flag), onPressed: () { markImportantAsDirty(); }, ), IconButton( icon: Icon(Icons.delete_outline), onPressed: handleDelete, ), IconButton( icon: Icon(OMIcons.share), onPressed: handleShare, ), IconButton( icon: Icon(OMIcons.edit), onPressed: handleEdit, ), ], ), ), )), ) ], )); } void handleSave() async { await NotesDatabaseService.db.updateNoteInDB(widget.currentNote); widget.triggerRefetch(); } void markImportantAsDirty() { setState(() { widget.currentNote.isImportant = !widget.currentNote.isImportant; }); handleSave(); } void handleEdit() { Navigator.pop(context); Navigator.push( context, CupertinoPageRoute( builder: (context) => EditNotePage( existingNote: widget.currentNote, triggerRefetch: widget.triggerRefetch, ))); } void handleShare() { Share.share( '${widget.currentNote.title.trim()}\n(On: ${widget.currentNote.date.toIso8601String().substring(0, 10)})\n\n${widget.currentNote.content}'); } void handleBack() { Navigator.pop(context); } void handleDelete() async { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), title: Text('Delete Note'), content: Text('This note will be deleted permanently'), actions: <Widget>[ FlatButton( child: Text('DELETE', style: TextStyle( color: Colors.red.shade300, fontWeight: FontWeight.w500, letterSpacing: 1)), onPressed: () async { await NotesDatabaseService.db .deleteNoteInDB(widget.currentNote); widget.triggerRefetch(); Navigator.pop(context); Navigator.pop(context); }, ), FlatButton( child: Text('CANCEL', style: TextStyle( color: Theme.of(context).primaryColor, fontWeight: FontWeight.w500, letterSpacing: 1)), onPressed: () { Navigator.pop(context); }, ) ], ); }); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/screens/edit.dart
import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart' as prefix0; import 'package:flutter/widgets.dart'; import 'package:notes/data/models.dart'; import 'package:notes/services/database.dart'; import 'package:outline_material_icons/outline_material_icons.dart'; class EditNotePage extends StatefulWidget { Function() triggerRefetch; NotesModel existingNote; EditNotePage({Key key, Function() triggerRefetch, NotesModel existingNote}) : super(key: key) { this.triggerRefetch = triggerRefetch; this.existingNote = existingNote; } @override _EditNotePageState createState() => _EditNotePageState(); } class _EditNotePageState extends State<EditNotePage> { bool isDirty = false; bool isNoteNew = true; FocusNode titleFocus = FocusNode(); FocusNode contentFocus = FocusNode(); NotesModel currentNote; TextEditingController titleController = TextEditingController(); TextEditingController contentController = TextEditingController(); @override void initState() { super.initState(); if (widget.existingNote == null) { currentNote = NotesModel( content: '', title: '', date: DateTime.now(), isImportant: false); isNoteNew = true; } else { currentNote = widget.existingNote; isNoteNew = false; } titleController.text = currentNote.title; contentController.text = currentNote.content; } @override Widget build(BuildContext context) { return Scaffold( body: Stack( children: <Widget>[ ListView( children: <Widget>[ Container( height: 80, ), Padding( padding: const EdgeInsets.all(16.0), child: TextField( focusNode: titleFocus, autofocus: true, controller: titleController, keyboardType: TextInputType.multiline, maxLines: null, onSubmitted: (text) { titleFocus.unfocus(); FocusScope.of(context).requestFocus(contentFocus); }, onChanged: (value) { markTitleAsDirty(value); }, textInputAction: TextInputAction.next, style: TextStyle( fontFamily: 'ZillaSlab', fontSize: 32, fontWeight: FontWeight.w700), decoration: InputDecoration.collapsed( hintText: 'Enter a title', hintStyle: TextStyle( color: Colors.grey.shade400, fontSize: 32, fontFamily: 'ZillaSlab', fontWeight: FontWeight.w700), border: InputBorder.none, ), ), ), Padding( padding: const EdgeInsets.all(16.0), child: TextField( focusNode: contentFocus, controller: contentController, keyboardType: TextInputType.multiline, maxLines: null, onChanged: (value) { markContentAsDirty(value); }, style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500), decoration: InputDecoration.collapsed( hintText: 'Start typing...', hintStyle: TextStyle( color: Colors.grey.shade400, fontSize: 18, fontWeight: FontWeight.w500), border: InputBorder.none, ), ), ) ], ), ClipRect( child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20), child: Container( height: 80, color: Theme.of(context).canvasColor.withOpacity(0.3), child: SafeArea( child: Row( children: <Widget>[ IconButton( icon: Icon(Icons.arrow_back), onPressed: handleBack, ), Spacer(), IconButton( tooltip: 'Mark note as important', icon: Icon(currentNote.isImportant ? Icons.flag : Icons.outlined_flag), onPressed: titleController.text.trim().isNotEmpty && contentController.text.trim().isNotEmpty ? markImportantAsDirty : null, ), IconButton( icon: Icon(Icons.delete_outline), onPressed: () { handleDelete(); }, ), AnimatedContainer( margin: EdgeInsets.only(left: 10), duration: Duration(milliseconds: 200), width: isDirty ? 100 : 0, height: 42, curve: Curves.decelerate, child: RaisedButton.icon( color: Theme.of(context).accentColor, textColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(100), bottomLeft: Radius.circular(100))), icon: Icon(Icons.done), label: Text( 'SAVE', style: TextStyle(letterSpacing: 1), ), onPressed: handleSave, ), ) ], ), ), )), ) ], )); } void handleSave() async { setState(() { currentNote.title = titleController.text; currentNote.content = contentController.text; print('Hey there ${currentNote.content}'); }); if (isNoteNew) { var latestNote = await NotesDatabaseService.db.addNoteInDB(currentNote); setState(() { currentNote = latestNote; }); } else { await NotesDatabaseService.db.updateNoteInDB(currentNote); } setState(() { isNoteNew = false; isDirty = false; }); widget.triggerRefetch(); titleFocus.unfocus(); contentFocus.unfocus(); } void markTitleAsDirty(String title) { setState(() { isDirty = true; }); } void markContentAsDirty(String content) { setState(() { isDirty = true; }); } void markImportantAsDirty() { setState(() { currentNote.isImportant = !currentNote.isImportant; }); handleSave(); } void handleDelete() async { if (isNoteNew) { Navigator.pop(context); } else { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8)), title: Text('Delete Note'), content: Text('This note will be deleted permanently'), actions: <Widget>[ FlatButton( child: Text('DELETE', style: prefix0.TextStyle( color: Colors.red.shade300, fontWeight: FontWeight.w500, letterSpacing: 1)), onPressed: () async { await NotesDatabaseService.db.deleteNoteInDB(currentNote); widget.triggerRefetch(); Navigator.pop(context); Navigator.pop(context); }, ), FlatButton( child: Text('CANCEL', style: TextStyle( color: Theme.of(context).primaryColor, fontWeight: FontWeight.w500, letterSpacing: 1)), onPressed: () { Navigator.pop(context); }, ) ], ); }); } } void handleBack() { Navigator.pop(context); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/screens/settings.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; import 'package:flutter/widgets.dart'; import 'package:notes/services/sharedPref.dart'; import 'package:outline_material_icons/outline_material_icons.dart'; import 'package:url_launcher/url_launcher.dart'; class SettingsPage extends StatefulWidget { Function(Brightness brightness) changeTheme; SettingsPage({Key key, Function(Brightness brightness) changeTheme}) : super(key: key) { this.changeTheme = changeTheme; } @override _SettingsPageState createState() => _SettingsPageState(); } class _SettingsPageState extends State<SettingsPage> { String selectedTheme; @override Widget build(BuildContext context) { setState(() { if (Theme.of(context).brightness == Brightness.dark) { selectedTheme = 'dark'; } else { selectedTheme = 'light'; } }); return Scaffold( body: ListView( physics: BouncingScrollPhysics(), children: <Widget>[ Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Navigator.pop(context); }, child: Container( padding: const EdgeInsets.only(top: 24, left: 24, right: 24), child: Icon(OMIcons.arrowBack)), ), Padding( padding: const EdgeInsets.only(left: 16, top: 36, right: 24), child: buildHeaderWidget(context), ), buildCardWidget(Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text('App Theme', style: TextStyle(fontFamily: 'ZillaSlab', fontSize: 24)), Container( height: 20, ), Row( children: <Widget>[ Radio( value: 'light', groupValue: selectedTheme, onChanged: handleThemeSelection, ), Text( 'Light theme', style: TextStyle(fontSize: 18), ) ], ), Row( children: <Widget>[ Radio( value: 'dark', groupValue: selectedTheme, onChanged: handleThemeSelection, ), Text( 'Dark theme', style: TextStyle(fontSize: 18), ) ], ), ], )), buildCardWidget(Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Text('About app', style: TextStyle( fontFamily: 'ZillaSlab', fontSize: 24, color: Theme.of(context).primaryColor)), Container( height: 40, ), Center( child: Text('Developed by'.toUpperCase(), style: TextStyle( color: Colors.grey.shade600, fontWeight: FontWeight.w500, letterSpacing: 1)), ), Center( child: Padding( padding: const EdgeInsets.only(top: 8.0, bottom: 4.0), child: Text( 'Roshan', style: TextStyle(fontFamily: 'ZillaSlab', fontSize: 24), ), )), Container( alignment: Alignment.center, child: OutlineButton.icon( icon: Icon(OMIcons.link), label: Text('GITHUB', style: TextStyle( fontWeight: FontWeight.w500, letterSpacing: 1, color: Colors.grey.shade500)), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16)), onPressed: openGitHub, ), ), Container( height: 30, ), Center( child: Text('Made With'.toUpperCase(), style: TextStyle( color: Colors.grey.shade600, fontWeight: FontWeight.w500, letterSpacing: 1)), ), Padding( padding: const EdgeInsets.all(8.0), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ FlutterLogo( size: 40, ), Padding( padding: const EdgeInsets.all(8.0), child: Text( 'Flutter', style: TextStyle( fontFamily: 'ZillaSlab', fontSize: 24), ), ) ], ), ), ), ], )) ], )) ], ), ); } Widget buildCardWidget(Widget child) { return Container( decoration: BoxDecoration( color: Theme.of(context).dialogBackgroundColor, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( offset: Offset(0, 8), color: Colors.black.withAlpha(20), blurRadius: 16) ]), margin: EdgeInsets.all(24), padding: EdgeInsets.all(16), child: child, ); } Widget buildHeaderWidget(BuildContext context) { return Container( margin: EdgeInsets.only(top: 8, bottom: 16, left: 8), child: Text( 'Settings', style: TextStyle( fontFamily: 'ZillaSlab', fontWeight: FontWeight.w700, fontSize: 36, color: Theme.of(context).primaryColor), ), ); } void handleThemeSelection(String value) { setState(() { selectedTheme = value; }); if (value == 'light') { widget.changeTheme(Brightness.light); } else { widget.changeTheme(Brightness.dark); } setThemeinSharedPref(value); } void openGitHub() { launch('https://www.github.com/roshanrahman'); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/lib/screens/home.dart
import 'dart:async'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; import 'package:notes/components/faderoute.dart'; import 'package:notes/data/models.dart'; import 'package:notes/screens/edit.dart'; import 'package:notes/screens/view.dart'; import 'package:notes/services/database.dart'; import 'settings.dart'; import 'package:outline_material_icons/outline_material_icons.dart'; import '../components/cards.dart'; class MyHomePage extends StatefulWidget { Function(Brightness brightness) changeTheme; MyHomePage({Key key, this.title, Function(Brightness brightness) changeTheme}) : super(key: key) { this.changeTheme = changeTheme; } final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { bool isFlagOn = false; bool headerShouldHide = false; List<NotesModel> notesList = []; TextEditingController searchController = TextEditingController(); bool isSearchEmpty = true; @override void initState() { super.initState(); NotesDatabaseService.db.init(); setNotesFromDB(); } setNotesFromDB() async { print("Entered setNotes"); var fetchedNotes = await NotesDatabaseService.db.getNotesFromDB(); setState(() { notesList = fetchedNotes; }); } @override Widget build(BuildContext context) { return Scaffold( floatingActionButton: FloatingActionButton.extended( backgroundColor: Theme.of(context).primaryColor, onPressed: () { gotoEditNote(); }, label: Text('Add note'.toUpperCase()), icon: Icon(Icons.add), ), body: GestureDetector( onTap: () { FocusScope.of(context).requestFocus(new FocusNode()); }, child: AnimatedContainer( duration: Duration(milliseconds: 200), child: ListView( physics: BouncingScrollPhysics(), children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Navigator.push( context, CupertinoPageRoute( builder: (context) => SettingsPage( changeTheme: widget.changeTheme))); }, child: AnimatedContainer( duration: Duration(milliseconds: 200), padding: EdgeInsets.all(16), alignment: Alignment.centerRight, child: Icon( OMIcons.settings, color: Theme.of(context).brightness == Brightness.light ? Colors.grey.shade600 : Colors.grey.shade300, ), ), ), ], ), buildHeaderWidget(context), buildButtonRow(), buildImportantIndicatorText(), Container(height: 32), ...buildNoteComponentsList(), GestureDetector( onTap: gotoEditNote, child: AddNoteCardComponent()), Container(height: 100) ], ), margin: EdgeInsets.only(top: 2), padding: EdgeInsets.only(left: 15, right: 15), ), ), ); } Widget buildButtonRow() { return Padding( padding: const EdgeInsets.only(left: 10, right: 10), child: Row( children: <Widget>[ GestureDetector( onTap: () { setState(() { isFlagOn = !isFlagOn; }); }, child: AnimatedContainer( duration: Duration(milliseconds: 160), height: 50, width: 50, curve: Curves.slowMiddle, child: Icon( isFlagOn ? Icons.flag : OMIcons.flag, color: isFlagOn ? Colors.white : Colors.grey.shade300, ), decoration: BoxDecoration( color: isFlagOn ? Colors.blue : Colors.transparent, border: Border.all( width: isFlagOn ? 2 : 1, color: isFlagOn ? Colors.blue.shade700 : Colors.grey.shade300, ), borderRadius: BorderRadius.all(Radius.circular(16))), ), ), Expanded( child: Container( alignment: Alignment.center, margin: EdgeInsets.only(left: 8), padding: EdgeInsets.only(left: 16), height: 50, decoration: BoxDecoration( border: Border.all(color: Colors.grey.shade300), borderRadius: BorderRadius.all(Radius.circular(16))), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Expanded( child: TextField( controller: searchController, maxLines: 1, onChanged: (value) { handleSearch(value); }, autofocus: false, keyboardType: TextInputType.text, style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500), textInputAction: TextInputAction.search, decoration: InputDecoration.collapsed( hintText: 'Search', hintStyle: TextStyle( color: Colors.grey.shade300, fontSize: 18, fontWeight: FontWeight.w500), border: InputBorder.none, ), ), ), IconButton( icon: Icon(isSearchEmpty ? Icons.search : Icons.cancel, color: Colors.grey.shade300), onPressed: cancelSearch, ), ], ), ), ) ], ), ); } Widget buildHeaderWidget(BuildContext context) { return Row( children: <Widget>[ AnimatedContainer( duration: Duration(milliseconds: 200), curve: Curves.easeIn, margin: EdgeInsets.only(top: 8, bottom: 32, left: 10), width: headerShouldHide ? 0 : 200, child: Text( 'Your Notes', style: TextStyle( fontFamily: 'ZillaSlab', fontWeight: FontWeight.w700, fontSize: 36, color: Theme.of(context).primaryColor), overflow: TextOverflow.clip, softWrap: false, ), ), ], ); } Widget testListItem(Color color) { return new NoteCardComponent( noteData: NotesModel.random(), ); } Widget buildImportantIndicatorText() { return AnimatedCrossFade( duration: Duration(milliseconds: 200), firstChild: Padding( padding: const EdgeInsets.only(top: 8), child: Text( 'Only showing notes marked important'.toUpperCase(), style: TextStyle( fontSize: 12, color: Colors.blue, fontWeight: FontWeight.w500), ), ), secondChild: Container( height: 2, ), crossFadeState: isFlagOn ? CrossFadeState.showFirst : CrossFadeState.showSecond, ); } List<Widget> buildNoteComponentsList() { List<Widget> noteComponentsList = []; notesList.sort((a, b) { return b.date.compareTo(a.date); }); if (searchController.text.isNotEmpty) { notesList.forEach((note) { if (note.title .toLowerCase() .contains(searchController.text.toLowerCase()) || note.content .toLowerCase() .contains(searchController.text.toLowerCase())) noteComponentsList.add(NoteCardComponent( noteData: note, onTapAction: openNoteToRead, )); }); return noteComponentsList; } if (isFlagOn) { notesList.forEach((note) { if (note.isImportant) noteComponentsList.add(NoteCardComponent( noteData: note, onTapAction: openNoteToRead, )); }); } else { notesList.forEach((note) { noteComponentsList.add(NoteCardComponent( noteData: note, onTapAction: openNoteToRead, )); }); } return noteComponentsList; } void handleSearch(String value) { if (value.isNotEmpty) { setState(() { isSearchEmpty = false; }); } else { setState(() { isSearchEmpty = true; }); } } void gotoEditNote() { Navigator.push( context, CupertinoPageRoute( builder: (context) => EditNotePage(triggerRefetch: refetchNotesFromDB))); } void refetchNotesFromDB() async { await setNotesFromDB(); print("Refetched notes"); } openNoteToRead(NotesModel noteData) async { setState(() { headerShouldHide = true; }); await Future.delayed(Duration(milliseconds: 230), () {}); Navigator.push( context, FadeRoute( page: ViewNotePage( triggerRefetch: refetchNotesFromDB, currentNote: noteData))); await Future.delayed(Duration(milliseconds: 300), () {}); setState(() { headerShouldHide = false; }); } void cancelSearch() { FocusScope.of(context).requestFocus(new FocusNode()); setState(() { searchController.clear(); isSearchEmpty = true; }); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/flutter-notes-app-master/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:notes/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros/lib/registration_screen.dart
import 'package:flutter/material.dart'; import 'package:bros/chat_screen.dart'; import 'constants.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; class RegistrationScreen extends StatefulWidget { static String id = 'registration_screen'; @override _RegistrationScreenState createState() => _RegistrationScreenState(); } class _RegistrationScreenState extends State<RegistrationScreen> { bool showSpinner = false; late String email; late String password; final _auth = FirebaseAuth.instance; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: ModalProgressHUD( inAsyncCall: showSpinner, child: Padding( padding: EdgeInsets.symmetric(horizontal: 24.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Flexible( child: Hero( tag: 'logo', child: Container( height: 200.0, child: Image.asset('images/chat.png'), ), ), ), SizedBox( height: 48.0, ), TextField( cursorColor: Colors.white, style: TextStyle(color: Colors.white), keyboardType: TextInputType.emailAddress, textAlign: TextAlign.center, onChanged: (value) { email = value; }, decoration: Idecor1, ), SizedBox( height: 8.0, ), TextField( cursorColor: Colors.white, style: TextStyle(color: Colors.white), obscureText: true, textAlign: TextAlign.center, onChanged: (value) { //Do something with the user input. password = value; }, decoration: Idecor2, ), SizedBox( height: 24.0, ), Padding( padding: EdgeInsets.symmetric(vertical: 16.0), child: Material( color: Colors.blueAccent, borderRadius: BorderRadius.all(Radius.circular(30.0)), elevation: 5.0, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(30.0), gradient: LinearGradient( colors: [ Color(0xFFff017f), Color(0xFFce24b3), Color(0xFFbb18d5) ], ), ), child: MaterialButton( onPressed: () async { //Implement registration functionality. try { setState(() { showSpinner = true; }); final NewUser = await _auth.createUserWithEmailAndPassword( email: email, password: password); if (NewUser != null) { Navigator.pushNamed(context, ChatScreen.id); setState(() { showSpinner = false; }); } } catch (e) { print(e); } }, minWidth: 200.0, height: 42.0, child: Text( 'Register', style: TextStyle(color: Colors.white), ), ), ), ), ), ], ), ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros/lib/welcome_screen.dart
import 'package:flutter/material.dart'; import 'package:bros/login_screen.dart'; import 'package:bros/registration_screen.dart'; import 'package:animated_text_kit/animated_text_kit.dart'; import 'Great.dart'; class WelcomeScreen extends StatefulWidget { static String id = 'welcome_screen'; @override _WelcomeScreenState createState() => _WelcomeScreenState(); } class _WelcomeScreenState extends State<WelcomeScreen> with SingleTickerProviderStateMixin { late AnimationController controller; late Animation animation; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: SafeArea( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ Hero( tag: 'logo', child: Container( height: 80.00, child: Image.asset('images/chat.png'), ), ), SizedBox(width: 20), SizedBox( width: 300, child: DefaultTextStyle( style: TextStyle( fontSize: 45.0, fontWeight: FontWeight.w900, color: Colors.white, ), child: AnimatedTextKit(animatedTexts: [ ColorizeAnimatedText( 'The Bro Code', textStyle: TextStyle( fontSize: 50, fontFamily: 'Lobster', ), colors: [ Colors.white, Colors.purple, Colors.blue, Colors.yellow, Colors.red, ], ), ]), ), ), ], ), SizedBox( height: 48.0, ), Great(Colors.white, 'Log In', LoginScreen.id), Great(Colors.white, 'Register', RegistrationScreen.id), ], ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros/lib/chat_screen.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:bros/constants.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:date_time_format/date_time_format.dart'; import 'package:intl/intl.dart'; class ChatScreen extends StatefulWidget { static String id = 'chat_screen'; @override _ChatScreenState createState() => _ChatScreenState(); } class _ChatScreenState extends State<ChatScreen> { final messageTextController = TextEditingController(); final _firestore = FirebaseFirestore.instance; final _auth = FirebaseAuth.instance; late String message; late User loggedIn; @override void initState() { getuser(); super.initState(); } void getuser() async { try { final user = await _auth.currentUser; if (user != null) { loggedIn = user; print(loggedIn.email); } } catch (e) { print(e); } } // void getMessages() async { // final message = await _firestore.collection('messages').get(); // final allData = message.docs.map((doc) => doc.data()).toList(); // // print(allData); // } void messagesStream() async { await for (var snapshot in _firestore.collection('messages').snapshots()) { for (var message in snapshot.docs) { print(message.data()); } } } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, appBar: AppBar( leading: null, actions: <Widget>[ IconButton( icon: Icon(Icons.logout), onPressed: () { //Implement logout functionality _auth.signOut(); Navigator.pop(context); }), ], title: Text( 'The Code Chamber', style: TextStyle(fontFamily: 'Lobster'), ), backgroundColor: Color(0xFF960fbd), ), body: SafeArea( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ StreamBuilder<QuerySnapshot>( stream: _firestore .collection('messages') .orderBy('time', descending: false) .snapshots(), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasData) { final messages = snapshot.data.docs.reversed; List<MessageBox> messageWidgets = []; for (var message in messages!) { final messageText = message['text']; final messageSender = message['sender']; final messageTime = message['time'] as Timestamp; final currentUser = loggedIn.email; final messageWidget = MessageBox( messageText, messageSender, currentUser == messageSender, messageTime); messageWidgets.add(messageWidget); } return Expanded( child: ListView( reverse: true, padding: EdgeInsets.symmetric(horizontal: 10, vertical: 20), children: messageWidgets, ), ); } else { return Center( child: CircularProgressIndicator( backgroundColor: Colors.blueAccent, ), ); } }), Container( decoration: kMessageContainerDecoration, child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[ Expanded( child: TextField( cursorColor: Colors.white, style: TextStyle(color: Colors.white), controller: messageTextController, onChanged: (value) { //Do something with the user input. message = value; }, decoration: kMessageTextFieldDecoration, ), ), FlatButton( onPressed: () { messageTextController.clear(); //Implement send functionality. _firestore.collection('messages').add({ 'text': message, 'sender': loggedIn.email, 'time': DateTime.now() }); }, child: Text( 'Send', style: kSendButtonTextStyle, ), ), ], ), ), ], ), ), ); } } class MessageBox extends StatelessWidget { MessageBox(this.newmessage, this.sender, this.isMe, this.time); final newmessage; final sender; final bool isMe; final time; @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.all(10.0), child: Column( crossAxisAlignment: isMe ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: <Widget>[ Text( '$sender ', style: TextStyle( fontSize: 12.0, color: isMe ? Colors.white : Colors.white), ), SizedBox( height: 5, ), // Text( // '$sender ', // style: TextStyle(fontSize: 12.0, color: Colors.black54), // ), Material( elevation: 5.00, borderRadius: isMe ? BorderRadius.only( topLeft: Radius.circular(30.00), bottomRight: Radius.circular(30.00), bottomLeft: Radius.circular(30.00)) : BorderRadius.only( topRight: Radius.circular(30.00), bottomRight: Radius.circular(30.00), bottomLeft: Radius.circular(30.00)), color: isMe ? Color(0xFF960fbd) : Color(0xFF252525), child: Padding( padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20), child: Column( crossAxisAlignment: isMe ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [ Text( '$newmessage', style: TextStyle( color: isMe ? Colors.white : Colors.white, fontSize: 15.00), ), SizedBox( height: 5, ), Text( '${DateTime.fromMillisecondsSinceEpoch(time.seconds * 1000)}', style: TextStyle( fontSize: 12.0, color: isMe ? Colors.white70 : Colors.white70), ), ], ), ), ), ], ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros/lib/constants.dart
import 'package:flutter/material.dart'; const kSendButtonTextStyle = TextStyle( color: Colors.purpleAccent, fontWeight: FontWeight.bold, fontSize: 18.0, ); const kMessageTextFieldDecoration = InputDecoration( contentPadding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0), hintText: 'Type your bro code here...', hintStyle: TextStyle(color: Colors.grey), border: InputBorder.none, ); const kMessageContainerDecoration = BoxDecoration( border: Border( top: BorderSide(color: Colors.purpleAccent, width: 2.0), ), ); const Idecor1 = InputDecoration( hintText: 'Enter your email', hintStyle: TextStyle(color: Colors.grey), contentPadding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0), border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(32.0)), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.purpleAccent, width: 1.0), borderRadius: BorderRadius.all(Radius.circular(32.0)), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.purpleAccent, width: 3.0), borderRadius: BorderRadius.all(Radius.circular(32.0)), ), ); const Idecor2 = InputDecoration( hintText: 'Enter your password', hintStyle: TextStyle(color: Colors.grey), contentPadding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0), border: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(32.0)), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.purpleAccent, width: 1.0), borderRadius: BorderRadius.all(Radius.circular(32.0)), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.purpleAccent, width: 2.0), borderRadius: BorderRadius.all(Radius.circular(32.0)), ), );
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros/lib/login_screen.dart
import 'package:flutter/material.dart'; import 'package:bros/chat_screen.dart'; import 'constants.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; class LoginScreen extends StatefulWidget { static String id = 'login_screen'; @override _LoginScreenState createState() => _LoginScreenState(); } class _LoginScreenState extends State<LoginScreen> { bool showSpinner = false; late String email; late String password; final _auth = FirebaseAuth.instance; late User LoggedInUser; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: ModalProgressHUD( inAsyncCall: showSpinner, child: Padding( padding: EdgeInsets.symmetric(horizontal: 24.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ Flexible( child: Hero( tag: 'logo', child: Container( height: 200.0, child: Image.asset('images/chat.png'), ), ), ), SizedBox( height: 48.0, ), TextField( cursorColor: Colors.white, style: TextStyle(color: Colors.white), keyboardType: TextInputType.emailAddress, textAlign: TextAlign.center, onChanged: (value) { //Do something with the user input. email = value; }, decoration: Idecor1, ), SizedBox( height: 8.0, ), TextField( cursorColor: Colors.white, style: TextStyle(color: Colors.white), obscureText: true, textAlign: TextAlign.center, onChanged: (value) { //Do something with the user input. password = value; }, decoration: Idecor2, ), SizedBox( height: 24.0, ), Padding( padding: EdgeInsets.symmetric(vertical: 16.0), child: Material( color: Colors.lightBlueAccent, borderRadius: BorderRadius.all(Radius.circular(30.0)), elevation: 5.0, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(30.0), gradient: LinearGradient( colors: [ Color(0xFFff017f), Color(0xFFce24b3), Color(0xFFbb18d5) ], ), ), child: MaterialButton( onPressed: () async { //Implement login functionality. setState(() { showSpinner = true; }); try { final user = await _auth.createUserWithEmailAndPassword( email: email, password: password); if (user != null) { Navigator.pushNamed(context, ChatScreen.id); setState(() { showSpinner = false; }); } } catch (e) { print(e); } }, minWidth: 200.0, height: 42.0, child: Text( 'Log In', ), ), ), ), ), ], ), ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros/lib/Great.dart
import 'package:flutter/material.dart'; class Great extends StatelessWidget { Great(this.color, this.text, this.id); final Color color; final String text; final String id; @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.symmetric(vertical: 16.0), child: Material( borderRadius: BorderRadius.circular(30.0), elevation: 5.0, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(30.0), gradient: LinearGradient( colors: [Color(0xFFff017f), Color(0xFFce24b3), Color(0xFFbb18d5)], ), ), child: MaterialButton( onPressed: () { //Go to registration screen. Navigator.pushNamed(context, id); }, minWidth: 200.0, height: 42.0, child: Text( text, style: TextStyle(color: Colors.white), ), ), ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros/lib/main.dart
import 'package:flutter/material.dart'; import 'package:bros/welcome_screen.dart'; import 'package:bros/login_screen.dart'; import 'package:bros/registration_screen.dart'; import 'package:bros/chat_screen.dart'; import 'package:firebase_core/firebase_core.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); runApp(FlashChat()); } class FlashChat extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData.dark().copyWith( textTheme: TextTheme( bodyMedium: TextStyle(color: Colors.black54), ), ), initialRoute: WelcomeScreen.id, routes: { ChatScreen.id: (context) => ChatScreen(), LoginScreen.id: (context) => LoginScreen(), RegistrationScreen.id: (context) => RegistrationScreen(), WelcomeScreen.id: (context) => WelcomeScreen(), }, ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Intermediate/Bros/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:bros/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/cart.dart
import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; class CartList extends StatefulWidget { @override _CartListState createState() => _CartListState(); } class _CartListState extends State<CartList> { final List<Map<dynamic, dynamic>> products = [ {'name': 'IPhone', 'rating': 3.0, 'image': 'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80', 'price': '200'}, {'name': 'IPhone X 2', 'rating': 3.0, 'image': 'https://images.unsplash.com/photo-1522205408450-add114ad53fe?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=368f45b0888aeb0b7b08e3a1084d3ede&auto=format&fit=crop&w=1950&q=80', 'price': '200'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80', 'price': '200'}, ]; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Cart'), ), body: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 12.0, bottom: 12.0), child: Container( child: Text(products.length.toString() + " ITEMS IN YOUR CART", textDirection: TextDirection.ltr, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)) ), ), Flexible( child: ListView.builder( itemCount: products.length, itemBuilder: (context, index) { final item = products[index]; return Dismissible( // Each Dismissible must contain a Key. Keys allow Flutter to // uniquely identify widgets. key: Key(UniqueKey().toString()), // Provide a function that tells the app // what to do after an item has been swiped away. onDismissed: (direction) { if(direction == DismissDirection.endToStart) { // Then show a snackbar. ScaffoldMessenger.of(context) .showSnackBar(SnackBar(content: Text(item['name'] + " dismissed"), duration: Duration(seconds: 1))); } else { // Then show a snackbar. ScaffoldMessenger.of(context) .showSnackBar(SnackBar(content: Text(item['name'] + " added to carts"), duration: Duration(seconds: 1))); } // Remove the item from the data source. setState(() { products.removeAt(index); }); }, // Show a red background as the item is swiped away. background: Container( decoration: BoxDecoration(color: Colors.red), padding: EdgeInsets.all(5.0), child: Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 20.0), child: Icon(Icons.delete, color: Colors.white), ), ], ), ), secondaryBackground: Container( decoration: BoxDecoration(color: Colors.red), padding: EdgeInsets.all(5.0), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ Padding( padding: const EdgeInsets.only(right: 20.0), child: Icon(Icons.delete, color: Colors.white), ), ], ), ), child: InkWell( onTap: () { print('Card tapped.'); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Divider( height: 0, ), Padding( padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), child: ListTile( trailing: Text('\$ ${item['price']}'), leading: ClipRRect( borderRadius: BorderRadius.circular(5.0), child: Container( decoration: BoxDecoration( color: Colors.blue ), child: CachedNetworkImage( fit: BoxFit.cover, imageUrl: item['image'], placeholder: (context, url) => Center( child: CircularProgressIndicator() ), errorWidget: (context, url, error) => new Icon(Icons.error), ), ), ), title: Text( item['name'], style: TextStyle( fontSize: 14 ), ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 2.0, bottom: 1), child: Text('in stock', style: TextStyle( color: Theme.of(context).colorScheme.secondary, fontWeight: FontWeight.w700, )), ) ], ) ], ), ), ), ], ), ), ); }), ), Container( child: Padding( padding: const EdgeInsets.only(left: 20.0, right: 20), child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(bottom :30.0), child: Row( children: <Widget>[ Expanded( child: Text("TOTAL", style: TextStyle(fontSize: 16, color: Colors.grey),) ), Text("\$41.24", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)), ], ), ), Padding( padding: const EdgeInsets.only(bottom: 15.0), child: Row( children: <Widget>[ Expanded( child: Text("Subtotal", style: TextStyle(fontSize: 14)) ), Text("\$36.00", style: TextStyle(fontSize: 14, color: Colors.grey)), ], ), ), Padding( padding: const EdgeInsets.only(bottom: 15.0), child: Row( children: <Widget>[ Expanded( child: Text("Shipping", style: TextStyle(fontSize: 14)) ), Text("\$2.00", style: TextStyle(fontSize: 14, color: Colors.grey)), ], ), ), Padding( padding: const EdgeInsets.only(bottom: 15.0), child: Row( children: <Widget>[ Expanded( child: Text("Tax", style: TextStyle(fontSize: 14)) ), Text("\$3.24", style: TextStyle(fontSize: 14, color: Colors.grey)), ], ), ), ], ), ) ), Padding( padding: const EdgeInsets.only(left: 20.0, right: 20, top: 50, bottom: 10), child: ButtonTheme( buttonColor: Theme.of(context).primaryColor, minWidth: double.infinity, height: 40.0, child: ElevatedButton( onPressed: () {}, child: Text( "CHECKOUT", style: TextStyle(color: Colors.white, fontSize: 16), ), ), ), ), ], ) ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/wishlist.dart
import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter_rating_stars/flutter_rating_stars.dart'; class WishList extends StatefulWidget { @override _WishlistState createState() => _WishlistState(); } class _WishlistState extends State<WishList> { final List<Map<dynamic, dynamic>> products = [ {'name': 'IPhone', 'rating': 3.0, 'image': 'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80'}, {'name': 'IPhone X 2', 'rating': 3.0, 'image': 'https://images.unsplash.com/photo-1522205408450-add114ad53fe?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=368f45b0888aeb0b7b08e3a1084d3ede&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 12', 'rating': 5.0, 'image': 'https://images.unsplash.com/photo-1523205771623-e0faa4d2813d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=89719a0d55dd05e2deae4120227e6efc&auto=format&fit=crop&w=1953&q=80'}, ]; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Wishlist'), ), body: ListView.builder( itemCount: products.length, itemBuilder: (context, index) { final item = products[index]; return Dismissible( // Each Dismissible must contain a Key. Keys allow Flutter to // uniquely identify widgets. key: Key(UniqueKey().toString()), // Provide a function that tells the app // what to do after an item has been swiped away. onDismissed: (direction) { if(direction == DismissDirection.endToStart) { // Then show a snackbar. ScaffoldMessenger.of(context) .showSnackBar(SnackBar(content: Text(item['name'] + " dismissed"), duration: Duration(seconds: 1))); } else { // Then show a snackbar. ScaffoldMessenger.of(context) .showSnackBar(SnackBar(content: Text(item['name'] + " added to carts"), duration: Duration(seconds: 1))); } // Remove the item from the data source. setState(() { products.removeAt(index); }); }, // Show a red background as the item is swiped away. background: Container( decoration: BoxDecoration(color: Colors.green), padding: EdgeInsets.all(5.0), child: Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 20.0), child: Icon(Icons.add_shopping_cart, color: Colors.white), ), ], ), ), secondaryBackground: Container( decoration: BoxDecoration(color: Colors.red), padding: EdgeInsets.all(5.0), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ Padding( padding: const EdgeInsets.only(right: 20.0), child: Icon(Icons.delete, color: Colors.white), ), ], ), ), child: InkWell( onTap: () { print('Card tapped.'); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Divider( height: 0, ), Padding( padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), child: ListTile( trailing: Icon(Icons.swap_horiz), leading: ClipRRect( borderRadius: BorderRadius.circular(5.0), child: Container( decoration: BoxDecoration( color: Colors.blue ), child: CachedNetworkImage( fit: BoxFit.cover, imageUrl: item['image'], placeholder: (context, url) => Center( child: CircularProgressIndicator() ), errorWidget: (context, url, error) => new Icon(Icons.error), ), ), ), title: Text( item['name'], style: TextStyle( fontSize: 14 ), ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 2.0, bottom: 1), child: Text('\$200', style: TextStyle( color: Theme.of(context).colorScheme.secondary, fontWeight: FontWeight.w700, )), ), Padding( padding: const EdgeInsets.only(left: 6.0), child: Text('(\$400)', style: TextStyle( fontWeight: FontWeight.w700, fontStyle: FontStyle.italic, color: Colors.grey, decoration: TextDecoration.lineThrough )), ) ], ), Row( children: <Widget>[ RatingStars( value: item['rating'], starSize: 16, valueLabelColor: Colors.amber, starColor: Colors.amber, ) ], ) ], ), ), ), ], ), ), ); }, ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/localizations_delegate.dart
import 'package:flutter/material.dart'; import 'package:flutter_ecommerce_ui_kit/localizations.dart'; class AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> { // This delegate instance will never change (it doesn't even have fields!) // It can provide a constant constructor. const AppLocalizationsDelegate(); @override bool isSupported(Locale locale) { // Include all of your supported language codes here return ['en', 'ar'].contains(locale.languageCode); } @override Future<AppLocalizations> load(Locale locale) async { // AppLocalizations class is where the JSON loading actually runs AppLocalizations localizations = new AppLocalizations(locale); await localizations.load(); return localizations; } @override bool shouldReload(AppLocalizationsDelegate old) => false; }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/config.dart
const String BASE_URL = 'http://localhost:9211/wp-json';
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/settings.dart
import 'package:flutter/material.dart'; class Settings extends StatefulWidget { @override _SettingsState createState() => _SettingsState(); } class _SettingsState extends State<Settings> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Settings'), ), body: SafeArea( child: Column( children: <Widget>[ Container( alignment: Alignment(1, 1), width: MediaQuery.of(context).size.width, height: 190, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, image: NetworkImage("https://images.pexels.com/photos/236047/pexels-photo-236047.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500"), ), ), child: Container( margin: EdgeInsets.only(right: 10, bottom: 10), decoration: BoxDecoration( color: Theme.of(context).primaryColor, borderRadius: new BorderRadius.circular(60), ), padding: const EdgeInsets.all(10.0), child: Icon( Icons.camera_alt, color: Colors.white, size: 32, ), ), ), Column( children: <Widget>[ Container( margin: EdgeInsets.only(bottom: 0), width: double.infinity, decoration: BoxDecoration( color: Theme.of(context).colorScheme.secondary, border: Border( bottom: BorderSide( // <--- left side color: Colors.grey.shade300, width: 1.0, ) ), ), child: Padding( padding: const EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15), child: Text( 'John Doe', style: TextStyle(color: Colors.white, fontSize: 16), ), ), ) ], ), Expanded( child: ListView( shrinkWrap: true, children: <Widget>[ Card( child: ListTile( leading: Icon(Icons.edit, color: Theme.of(context).colorScheme.secondary, size: 28,), title: Text('Profile', style: TextStyle(color: Colors.black, fontSize: 17)), trailing: Icon(Icons.keyboard_arrow_right, color: Theme.of(context).colorScheme.secondary), ), ), Card( child: ListTile( leading: Icon(Icons.notifications, color: Theme.of(context).colorScheme.secondary, size: 28,), title: Text('Notifications', style: TextStyle(color: Colors.black, fontSize: 17)), trailing: Icon(Icons.keyboard_arrow_right, color: Theme.of(context).colorScheme.secondary), ), ), Card( child: ListTile( leading: Icon(Icons.panorama, color: Theme.of(context).colorScheme.secondary, size: 28,), title: Text('Progress', style: TextStyle(color: Colors.black, fontSize: 17)), trailing: Icon(Icons.keyboard_arrow_right, color: Theme.of(context).colorScheme.secondary), ), ), Card( child: ListTile( leading: Icon(Icons.favorite, color: Theme.of(context).colorScheme.secondary, size: 28,), title: Text('Favorite', style: TextStyle(color: Colors.black, fontSize: 17)), trailing: Icon(Icons.keyboard_arrow_right, color: Theme.of(context).colorScheme.secondary), ), ), Card( child: ListTile( leading: Icon(Icons.feedback, color: Theme.of(context).colorScheme.secondary, size: 28,), title: Text('Feedback', style: TextStyle(color: Colors.black, fontSize: 17)), trailing: Icon(Icons.keyboard_arrow_right, color: Theme.of(context).colorScheme.secondary), ), ), Card( child: ListTile( leading: Icon(Icons.add_photo_alternate, color: Theme.of(context).colorScheme.secondary, size: 28,), title: Text('About Us', style: TextStyle(color: Colors.black, fontSize: 17)), trailing: Icon(Icons.keyboard_arrow_right, color: Theme.of(context).colorScheme.secondary), ), ), Card( child: ListTile( leading: Icon(Icons.vpn_key, color: Theme.of(context).colorScheme.secondary, size: 28,), title: Text('Change Password', style: TextStyle(color: Colors.black, fontSize: 17)), trailing: Icon(Icons.keyboard_arrow_right, color: Theme.of(context).colorScheme.secondary), ), ), Card( child: ListTile( leading: Icon(Icons.lock, color: Theme.of(context).colorScheme.secondary, size: 28,), title: Text('Logout', style: TextStyle(color: Colors.black, fontSize: 17)), trailing: Icon(Icons.keyboard_arrow_right, color: Theme.of(context).colorScheme.secondary), ), ), ], ), ), ], ), ) ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_ecommerce_ui_kit/auth/auth.dart'; import 'package:flutter_ecommerce_ui_kit/blocks/auth_block.dart'; import 'package:flutter_ecommerce_ui_kit/cart.dart'; import 'package:flutter_ecommerce_ui_kit/categorise.dart'; import 'package:flutter_ecommerce_ui_kit/home/home.dart'; import 'package:flutter_ecommerce_ui_kit/localizations.dart'; import 'package:flutter_ecommerce_ui_kit/product_detail.dart'; import 'package:flutter_ecommerce_ui_kit/settings.dart'; import 'package:flutter_ecommerce_ui_kit/shop/shop.dart'; import 'package:flutter_ecommerce_ui_kit/wishlist.dart'; import 'package:provider/provider.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); final Locale locale = Locale('en'); runApp(MultiProvider( providers: [ChangeNotifierProvider<AuthBlock>.value(value: AuthBlock())], child: MaterialApp( localizationsDelegates: [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: [Locale('en'), Locale('ar')], locale: locale, debugShowCheckedModeBanner: false, theme: ThemeData( primaryColor: Colors.deepOrange.shade500, colorScheme: ColorScheme.fromSwatch() .copyWith(secondary: Colors.lightBlue.shade900), fontFamily: locale.languageCode == 'ar' ? 'Dubai' : 'Lato', ), initialRoute: '/', routes: <String, WidgetBuilder>{ '/': (BuildContext context) => Home(), '/auth': (BuildContext context) => Auth(), '/shop': (BuildContext context) => Shop(), '/categorise': (BuildContext context) => Categorise(), '/wishlist': (BuildContext context) => WishList(), '/cart': (BuildContext context) => CartList(), '/settings': (BuildContext context) => Settings(), '/products': (BuildContext context) => Products() }, ), )); }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/categorise.dart
import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; class Categorise extends StatefulWidget { @override _CategoriseState createState() => _CategoriseState(); } class _CategoriseState extends State<Categorise> { final List<String> imgList = [ 'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80', 'https://images.unsplash.com/photo-1522205408450-add114ad53fe?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=368f45b0888aeb0b7b08e3a1084d3ede&auto=format&fit=crop&w=1950&q=80', 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80', 'https://images.unsplash.com/photo-1523205771623-e0faa4d2813d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=89719a0d55dd05e2deae4120227e6efc&auto=format&fit=crop&w=1953&q=80', 'https://images.unsplash.com/photo-1508704019882-f9cf40e475b4?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8c6e5e3aba713b17aa1fe71ab4f0ae5b&auto=format&fit=crop&w=1352&q=80', 'https://images.unsplash.com/photo-1519985176271-adb1088fa94c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=a0c8d632e977f94e5d312d9893258f59&auto=format&fit=crop&w=1355&q=80' ]; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Categorise'), ), body: SafeArea( top: false, left: false, right: false, child: Container( child: ListView( shrinkWrap: true, padding: EdgeInsets.only(top: 8, left: 6, right: 6, bottom: 8), children: List.generate(6, (index) { return Container( child: Card( clipBehavior: Clip.antiAlias, child: InkWell( onTap: () { print('Card tapped.'); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ SizedBox( height: 180, width: double.infinity, child: CachedNetworkImage( fit: BoxFit.cover, imageUrl: imgList[index], placeholder: (context, url) => Center( child: CircularProgressIndicator() ), errorWidget: (context, url, error) => new Icon(Icons.error), ), ), ListTile( title: Text( 'Two Gold Rings', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16 ), ) ) ], ), ), ), ); }), ), )), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/product_detail.dart
import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_rating_stars/flutter_rating_stars.dart'; class Products extends StatelessWidget { @override Widget build(BuildContext context) { final imageUrl = ModalRoute.of(context)!.settings.arguments; return Scaffold( appBar: AppBar( title: Text('Product Detail'), ), body: SafeArea( top: false, left: false, right: false, child: SingleChildScrollView( child: Column( children: <Widget>[ SizedBox( width: double.infinity, height: 260, child: Hero( tag: imageUrl!, child: CachedNetworkImage( fit: BoxFit.cover, imageUrl: imageUrl.toString(), placeholder: (context, url) => Center(child: CircularProgressIndicator()), errorWidget: (context, url, error) => new Icon(Icons.error), ), ), ), Padding( padding: const EdgeInsets.only(left: 15, right: 15), child: Column( children: <Widget>[ Container( alignment: Alignment(-1.0, -1.0), child: Padding( padding: const EdgeInsets.only(top: 15, bottom: 15), child: Text( 'Product Title Name', style: TextStyle(color: Colors.black, fontSize: 24, fontWeight: FontWeight.w600), ), ), ), Padding( padding: const EdgeInsets.only(bottom: 25), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(right: 10.0), child: Text( '\$90', style: TextStyle( color: Theme.of(context).primaryColor, fontSize: 20, fontWeight: FontWeight.w600, ), ), ), Text( '\$190', style: TextStyle( color: Colors.black, fontSize: 16, decoration: TextDecoration.lineThrough ) ), ], ), Row( children: <Widget>[ RatingStars( value: 5, starSize: 16, valueLabelColor: Colors.amber, starColor: Colors.amber, ) ], ), ], ), ), Column( children: <Widget>[ Container( alignment: Alignment(-1.0, -1.0), child: Padding( padding: const EdgeInsets.only(bottom: 10.0), child: Text( 'Description', style: TextStyle(color: Colors.black, fontSize: 20, fontWeight: FontWeight.w600), ), ) ), Container( alignment: Alignment(-1.0, -1.0), child: Padding( padding: const EdgeInsets.only(bottom: 10.0), child: Text( "Lorem Ipsum is simply dummy text of the printing and typesetting industry. but also the leap into electronic typesetting Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.", style: TextStyle(color: Colors.black, fontSize: 16), ), ) ) ], ), ], ), ) ], ), ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/localizations.dart
import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_ecommerce_ui_kit/localizations_delegate.dart'; class AppLocalizations { final Locale locale; AppLocalizations(this.locale); // Helper method to keep the code in the widgets concise // Localizations are accessed using an InheritedWidget "of" syntax static AppLocalizations? of(BuildContext context) { return Localizations.of<AppLocalizations>(context, AppLocalizations); } // Static member to have a simple access to the delegate from the MaterialApp static const LocalizationsDelegate<AppLocalizations> delegate = AppLocalizationsDelegate(); late Map<String, String> _localizedStrings; Future<bool> load() async { // Load the language JSON file from the "lang" folder String jsonString = await rootBundle.loadString('assets/i18n/${locale.languageCode}.json'); Map<String, dynamic> jsonMap = jsonDecode(jsonString); _localizedStrings = jsonMap.map((key, value) { return MapEntry(key, value.toString()); }); return true; } // This method will be called from every widget which needs a localized text String? translate(String key) { return _localizedStrings[key]; } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/blocks/auth_block.dart
import 'package:flutter/material.dart'; import 'package:flutter_ecommerce_ui_kit/models/user.dart'; import 'package:flutter_ecommerce_ui_kit/services/auth_service.dart'; class AuthBlock extends ChangeNotifier { AuthBlock() { setUser(); } AuthService _authService = AuthService(); // Index int _currentIndex = 1; int get currentIndex => _currentIndex; set currentIndex(int index) { _currentIndex = index; notifyListeners(); } // Loading bool _loading = false; late String _loadingType; bool get loading => _loading; String get loadingType => _loadingType; set loading(bool loadingState) { _loading = loadingState; notifyListeners(); } set loadingType(String loadingType) { _loadingType = loadingType; notifyListeners(); } // Loading bool _isLoggedIn = false; bool get isLoggedIn => _isLoggedIn; set isLoggedIn(bool isUserExist) { _isLoggedIn = isUserExist; notifyListeners(); } // just in case if you want to see how logged in drawer would look like, uncomment _user and comment _authService.getUser() // Map _user = {'user_email': '[email protected]', 'user_display_name': 'Muhammad Furqan'}; Map _user = {}; Map get user => _user; setUser() async { // _user = await _authService.getUser(); isLoggedIn = _user.isNotEmpty ; notifyListeners(); } login(UserCredential userCredential) async { loading = true; loadingType = 'login'; await _authService.login(userCredential); setUser(); loading = false; } register(User user) async { loading = true; loadingType = 'register'; await _authService.register(user); loading = false; } logout() async { await _authService.logout(); isLoggedIn = false; notifyListeners(); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/shop/shop.dart
import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter_rating_stars/flutter_rating_stars.dart'; import 'search.dart'; class Shop extends StatefulWidget { @override _ShopState createState() => _ShopState(); } class _ShopState extends State<Shop> { final List<Map<dynamic, dynamic>> products = [ {'name': 'IPhone', 'rating': 3.0, 'image': 'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80'}, {'name': 'IPhone X 2', 'rating': 3.0, 'image': 'https://images.unsplash.com/photo-1522205408450-add114ad53fe?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=368f45b0888aeb0b7b08e3a1084d3ede&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 11', 'rating': 4.0, 'image': 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80'}, {'name': 'IPhone 12', 'rating': 5.0, 'image': 'https://images.unsplash.com/photo-1523205771623-e0faa4d2813d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=89719a0d55dd05e2deae4120227e6efc&auto=format&fit=crop&w=1953&q=80'}, ]; final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); @override Widget build(BuildContext context) { return DefaultTabController( length: 2, child: Scaffold( key: scaffoldKey, appBar: AppBar( actions: <Widget>[ IconButton( icon: Icon(Icons.search, color: Colors.white), onPressed: () { scaffoldKey.currentState! .showBottomSheet((context) => ShopSearch()); }, ) ], title: Text('Shop'), ), body: Builder( builder: (BuildContext context) { return DefaultTabController( length: 2, child: Column( children: <Widget>[ Container( constraints: BoxConstraints(maxHeight: 150.0), child: Material( color: Theme.of(context).colorScheme.secondary, child: TabBar( indicatorColor: Colors.blue, tabs: [ Tab(icon: Icon(Icons.view_list)), Tab(icon: Icon(Icons.grid_on)), ], ), ), ), Expanded( child: TabBarView( children: [ Container( child: ListView( children: products.map((product) { return Builder( builder: (BuildContext context) { return InkWell( onTap: () { print('Card tapped.'); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Divider( height: 0, ), Padding( padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), child: ListTile( trailing: Icon(Icons.navigate_next), leading: ClipRRect( borderRadius: BorderRadius.circular(5.0), child: Container( decoration: BoxDecoration( color: Colors.blue ), child: CachedNetworkImage( fit: BoxFit.cover, imageUrl: product['image'], placeholder: (context, url) => Center( child: CircularProgressIndicator() ), errorWidget: (context, url, error) => new Icon(Icons.error), ), ), ), title: Text( product['name'], style: TextStyle( fontSize: 14 ), ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 2.0, bottom: 1), child: Text('\$200', style: TextStyle( color: Theme.of(context).colorScheme.secondary, fontWeight: FontWeight.w700, )), ), Padding( padding: const EdgeInsets.only(left: 6.0), child: Text('(\$400)', style: TextStyle( fontWeight: FontWeight.w700, fontStyle: FontStyle.italic, color: Colors.grey, decoration: TextDecoration.lineThrough )), ) ], ), Row( children: <Widget>[ RatingStars( value: product['rating'], starSize: 16, valueLabelColor: Colors.amber, starColor: Colors.amber, ) ], ) ], ), ), ), ], ), ); }, ); }).toList(), ), ), Container( child: GridView.count( shrinkWrap: true, crossAxisCount: 2, childAspectRatio: 0.7, padding: EdgeInsets.only(top: 8, left: 6, right: 6, bottom: 12), children: List.generate(products.length, (index) { return Container( child: Card( clipBehavior: Clip.antiAlias, child: InkWell( onTap: () { print('Card tapped.'); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ SizedBox( height: (MediaQuery.of(context).size.width / 2 - 5), width: double.infinity, child: CachedNetworkImage( fit: BoxFit.cover, imageUrl: products[index]['image'], placeholder: (context, url) => Center( child: CircularProgressIndicator() ), errorWidget: (context, url, error) => new Icon(Icons.error), ), ), Padding( padding: const EdgeInsets.only(top: 5.0), child: ListTile( title: Text( 'Two Gold Rings', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16 ), ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Row( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 2.0, bottom: 1), child: Text('\$200', style: TextStyle( color: Theme.of(context).colorScheme.secondary, fontWeight: FontWeight.w700, )), ), Padding( padding: const EdgeInsets.only(left: 6.0), child: Text('(\$400)', style: TextStyle( fontWeight: FontWeight.w700, fontStyle: FontStyle.italic, color: Colors.grey, decoration: TextDecoration.lineThrough )), ) ], ), Row( children: <Widget>[ RatingStars( value: products[index]['rating'], starSize: 16, valueLabelColor: Colors.amber, starColor: Colors.amber, ) ], ) ], ), ), ) ], ), ), ), ); }), ), ), ], ), ), ], )); }, ), // body: DefaultTabController( // length: 2, // child: Column( // children: <Widget>[ // Container( // constraints: BoxConstraints(maxHeight: 150.0), // child: Material( // color: Theme.of(context).accentColor, // child: TabBar( // indicatorColor: Colors.blue, // tabs: [ // Tab(icon: Icon(Icons.view_list)), // Tab(icon: Icon(Icons.grid_on)), // ], // ), // ), // ), // Expanded( // child: TabBarView( // children: [ // Container( // child: ListView( // children: products.map((product) { // return Builder( // builder: (BuildContext context) { // return InkWell( // onTap: () { // print('Card tapped.'); // }, // child: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: <Widget>[ // Divider( // height: 0, // ), // Padding( // padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), // child: ListTile( // trailing: Icon(Icons.navigate_next), // leading: ClipRRect( // borderRadius: BorderRadius.circular(5.0), // child: Container( // decoration: BoxDecoration( // color: Colors.blue // ), // child: CachedNetworkImage( // fit: BoxFit.cover, // imageUrl: product['image'], // placeholder: (context, url) => Center( // child: CircularProgressIndicator() // ), // errorWidget: (context, url, error) => new Icon(Icons.error), // ), // ), // ), // title: Text( // product['name'], // style: TextStyle( // fontSize: 14 // ), // ), // subtitle: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: <Widget>[ // Row( // children: <Widget>[ // Padding( // padding: const EdgeInsets.only(top: 2.0, bottom: 1), // child: Text('\$200', style: TextStyle( // color: Theme.of(context).accentColor, // fontWeight: FontWeight.w700, // )), // ), // Padding( // padding: const EdgeInsets.only(left: 6.0), // child: Text('(\$400)', style: TextStyle( // fontWeight: FontWeight.w700, // fontStyle: FontStyle.italic, // color: Colors.grey, // decoration: TextDecoration.lineThrough // )), // ) // ], // ), // Row( // children: <Widget>[ // SmoothStarRating( // allowHalfRating: false, // onRatingChanged: (v) { // product['rating'] = v; // setState(() {}); // }, // starCount: 5, // rating: product['rating'], // size: 16.0, // color: Colors.amber, // borderColor: Colors.amber, // spacing:0.0 // ), // Padding( // padding: const EdgeInsets.only(left: 6.0), // child: Text('(4)', style: TextStyle( // fontWeight: FontWeight.w300, // color: Theme.of(context).primaryColor // )), // ) // ], // ) // ], // ), // ), // ), // ], // ), // ); // }, // ); // }).toList(), // ), // ), // Container( // child: GridView.count( // shrinkWrap: true, // crossAxisCount: 2, // childAspectRatio: 0.7, // padding: EdgeInsets.only(top: 8, left: 6, right: 6, bottom: 12), // children: List.generate(products.length, (index) { // return Container( // child: Card( // clipBehavior: Clip.antiAlias, // child: InkWell( // onTap: () { // print('Card tapped.'); // }, // child: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: <Widget>[ // SizedBox( // height: (MediaQuery.of(context).size.width / 2 - 5), // width: double.infinity, // child: CachedNetworkImage( // fit: BoxFit.cover, // imageUrl: products[index]['image'], // placeholder: (context, url) => Center( // child: CircularProgressIndicator() // ), // errorWidget: (context, url, error) => new Icon(Icons.error), // ), // ), // Padding( // padding: const EdgeInsets.only(top: 5.0), // child: ListTile( // title: Text( // 'Two Gold Rings', // style: TextStyle( // fontWeight: FontWeight.bold, // fontSize: 16 // ), // ), // subtitle: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: <Widget>[ // Row( // children: <Widget>[ // Padding( // padding: const EdgeInsets.only(top: 2.0, bottom: 1), // child: Text('\$200', style: TextStyle( // color: Theme.of(context).accentColor, // fontWeight: FontWeight.w700, // )), // ), // Padding( // padding: const EdgeInsets.only(left: 6.0), // child: Text('(\$400)', style: TextStyle( // fontWeight: FontWeight.w700, // fontStyle: FontStyle.italic, // color: Colors.grey, // decoration: TextDecoration.lineThrough // )), // ) // ], // ), // Row( // children: <Widget>[ // SmoothStarRating( // allowHalfRating: false, // onRatingChanged: (v) { // products[index]['rating'] = v; // setState(() {}); // }, // starCount: 5, // rating: products[index]['rating'], // size: 16.0, // color: Colors.amber, // borderColor: Colors.amber, // spacing:0.0 // ), // Padding( // padding: const EdgeInsets.only(left: 6.0), // child: Text('(4)', style: TextStyle( // fontWeight: FontWeight.w300, // color: Theme.of(context).primaryColor // )), // ) // ], // ) // ], // ), // ), // ) // ], // ), // ), // ), // ); // }), // ), // ), // ], // ), // ), // ], // )) ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/shop/search.dart
import 'package:flutter/material.dart'; class ShopSearch extends StatefulWidget { @override _ShopSearchState createState() => _ShopSearchState(); } class _ShopSearchState extends State<ShopSearch> { String dropdownValue = 'One'; RangeValues _values = RangeValues(0.0, 500.0); Widget build(BuildContext context) { return Container( height: 425, width: double.infinity, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(15)), boxShadow: [ BoxShadow( blurRadius: 2, color: Colors.black12, spreadRadius: 3) ]), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 5.0, bottom: 15), child: Container( width: 30, height: 2, decoration: BoxDecoration( color: Colors.grey[400], borderRadius: BorderRadius.all(Radius.circular(20)), ), ), ), Container( margin: new EdgeInsetsDirectional.only(bottom: 15.0), child: Padding( padding: const EdgeInsets.only(left: 20, right: 20), child: DropdownButton<String>( isExpanded: true, value: dropdownValue, icon: Icon(Icons.keyboard_arrow_down), style: TextStyle( color: Colors.black ), underline: Container( height: 1, color: Colors.grey[300], ), onChanged: (String? newValue) { setState(() { dropdownValue = newValue!; }); }, items: <String>['One', 'Two', 'Free', 'Four'] .map<DropdownMenuItem<String>>((String value) { return DropdownMenuItem<String>( value: value, child: Text(value), ); }) .toList(), ), ), ), Padding( padding: const EdgeInsets.only(top: 15), child: Text( 'Select Price Range', style: TextStyle(fontWeight: FontWeight.bold) ), ), RangeSlider( values: _values, min: 0, max: 5000, activeColor: Theme.of(context).primaryColor, inactiveColor: Colors.grey[300], onChanged: (RangeValues values) { setState(() { if (values.end - values.start >= 20) { _values = values; } else { if (_values.start == values.start) { _values = RangeValues(_values.start, _values.start + 20); } else { _values = RangeValues(_values.end - 20, _values.end); } } }); } ), ], ), Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 20, right: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Container( width: 120, height: 45.0, alignment: Alignment.center, decoration: BoxDecoration(color: Theme.of(context).colorScheme.secondary), child: Padding( padding: const EdgeInsets.all(8.0), child: Text('\$ ${_values.start.round()}', style: TextStyle(color: Colors.white)), ) ), Text('to', style: TextStyle(fontSize: 16, color: Colors.black),), Container( width: 120, height: 45.0, alignment: Alignment.center, decoration: BoxDecoration(color: Theme.of(context).colorScheme.secondary), child: Padding( padding: const EdgeInsets.all(8.0), child: Text('\$ ${_values.end.round()}', style: TextStyle(color: Colors.white)), ) ), ], ), ), ], ), Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 20.0, right: 20, bottom: 15), child: Column( mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ ButtonTheme( buttonColor: Theme.of(context).primaryColor, minWidth: double.infinity, height: 40.0, child: ElevatedButton( onPressed: () {}, child: Text( "Apply Filters", style: TextStyle(color: Colors.white, fontSize: 16), ), ), ), ], ), ), ], ), ], ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/models/user.dart
class User { String username; String email; String password; User({required this.username, required this.email, required this.password}); factory User.fromJson(Map<String, dynamic> json) { return User( username: json['username'], email: json['email'], password: json['password'] ); } } class UserCredential { String usernameOrEmail; String password; UserCredential({required this.usernameOrEmail, required this.password}); }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/auth/auth.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:flutter_ecommerce_ui_kit/blocks/auth_block.dart'; import 'signin.dart'; import 'signup.dart'; class Auth extends StatelessWidget { final List<Widget> tabs = [ SignIn(), SignUp() ]; @override Widget build(BuildContext context) { final AuthBlock authBlock = Provider.of<AuthBlock>(context); return Scaffold( appBar: AppBar( title: Text(authBlock.currentIndex == 0 ? 'Sign In' : 'Create Account'), ), bottomNavigationBar: BottomNavigationBar( items: const <BottomNavigationBarItem>[ BottomNavigationBarItem( icon: Icon(Icons.lock_open), label: 'Sign In', ), BottomNavigationBarItem( icon: Icon(Icons.people_outline), label: 'Create Account', ), ], currentIndex: authBlock.currentIndex, selectedItemColor: Colors.amber[800], onTap: (num){ authBlock.currentIndex = num; }, ), body: tabs[authBlock.currentIndex], ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/auth/signin.dart
import 'package:flutter/material.dart'; import 'package:flutter_ecommerce_ui_kit/blocks/auth_block.dart'; import 'package:flutter_ecommerce_ui_kit/models/user.dart'; import 'package:provider/provider.dart'; class SignIn extends StatefulWidget { @override _SignInState createState() => _SignInState(); } class _SignInState extends State<SignIn> { final _formKey = GlobalKey<FormState>(); final UserCredential userCredential = UserCredential(usernameOrEmail: '', password: ''); @override Widget build(BuildContext context) { return Center( child: Form( key: _formKey, child: SingleChildScrollView( child: Padding( padding: const EdgeInsets.only(left: 15.0, right: 15.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Padding( padding: const EdgeInsets.only(bottom: 12.0), child: TextFormField( keyboardType: TextInputType.emailAddress, validator: (value) { if (value!.isEmpty) { return 'Please Enter Email or Username'; } return null; }, onSaved: (value) { setState(() { userCredential.usernameOrEmail = value!; }); }, decoration: InputDecoration( hintText: 'Enter Username Or Email', labelText: 'Email', ), ), ), TextFormField( validator: (value) { if (value!.isEmpty) { return 'Please Enter Password'; } return null; }, onSaved: (value) { setState(() { userCredential.password = value!; }); }, decoration: InputDecoration( hintText: 'Enter Password', labelText: 'Password', ), obscureText: true, ), Padding( padding: const EdgeInsets.only(top: 25.0), child: SizedBox( width: double.infinity, height: 50, child: Consumer<AuthBlock>( builder: (BuildContext context, AuthBlock auth, Widget? child) { return ElevatedButton( style: ElevatedButton.styleFrom( primary: Theme.of(context).primaryColor, ), child: auth.loading && auth.loadingType == 'login' ? CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>( Colors.white), ) : Text( 'Sign In', style: TextStyle(color: Colors.white), ), onPressed: () { // Validate form if (_formKey.currentState!.validate() && !auth.loading) { // Update values _formKey.currentState!.save(); // Hit Api auth.login(userCredential); } }, ); }, ), ), ) ], ), ), ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/auth/signup.dart
import 'package:flutter/material.dart'; import 'package:flutter_ecommerce_ui_kit/blocks/auth_block.dart'; import 'package:flutter_ecommerce_ui_kit/models/user.dart'; import 'package:provider/provider.dart'; class SignUp extends StatefulWidget { @override _SignUpState createState() => _SignUpState(); } class _SignUpState extends State<SignUp> { final _formKey = GlobalKey<FormState>(); final User user = User(password: '', username: '', email: ''); late String confirmPassword; @override Widget build(BuildContext context) { return Center( child: Form( key: _formKey, child: SingleChildScrollView( child: Padding( padding: const EdgeInsets.only(left: 15.0, right: 15.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Padding( padding: const EdgeInsets.only(bottom: 12.0), child: TextFormField( validator: (value) { if (value!.isEmpty) { return 'Please Enter Username'; } return null; }, onSaved: (value) { setState(() { user.username = value!; }); }, decoration: InputDecoration( hintText: 'Enter Username', labelText: 'Username', ), ), ), Padding( padding: const EdgeInsets.only(bottom: 12.0), child: TextFormField( validator: (value) { if (value!.isEmpty) { return 'Please Enter Email Address'; } return null; }, onSaved: (value) { setState(() { user.email = value!; }); }, decoration: InputDecoration( hintText: 'Enter Email', labelText: 'Email', ), ), ), Padding( padding: const EdgeInsets.only(bottom: 12.0), child: TextFormField( validator: (value) { if (value!.isEmpty) { return 'Please Enter Password'; } return null; }, onSaved: (value) { setState(() { user.password = value!; }); }, onChanged: (text) { user.password = text; }, decoration: InputDecoration( hintText: 'Enter Password', labelText: 'Password', ), obscureText: true), ), TextFormField( validator: (value) { if (value!.isEmpty) { return 'Please Enter Confirm Password'; } else if (user.password != confirmPassword) { return 'Password fields dont match'; } return null; }, onChanged: (text) { confirmPassword = text; }, decoration: InputDecoration( hintText: 'Enter Same Password', labelText: 'Confirm Password', ), obscureText: true, ), Padding( padding: const EdgeInsets.only(top: 25.0), child: SizedBox( width: double.infinity, height: 50, child: Consumer<AuthBlock>(builder: (BuildContext context, AuthBlock auth, Widget? child) { return ElevatedButton( style: ElevatedButton.styleFrom( primary: Theme.of(context).primaryColor, ), child: auth.loading && auth.loadingType == 'register' ? CircularProgressIndicator( valueColor: AlwaysStoppedAnimation<Color>(Colors.white), ) : Text( 'Sign Up', style: TextStyle(color: Colors.white), ), onPressed: () { if (_formKey.currentState!.validate() && !auth.loading) { _formKey.currentState!.save(); // If the form is valid, display a snackbar. In the real world, // you'd often call a server or save the information in a database. auth.register(user); } }, ); }), ), ) ], ), ), ), ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/home/slider.dart
import 'package:flutter/material.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:cached_network_image/cached_network_image.dart'; class HomeSlider extends StatefulWidget { @override _HomeSliderState createState() => _HomeSliderState(); } class _HomeSliderState extends State<HomeSlider> { final List<String> imgList = [ 'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80', 'https://images.unsplash.com/photo-1522205408450-add114ad53fe?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=368f45b0888aeb0b7b08e3a1084d3ede&auto=format&fit=crop&w=1950&q=80', 'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80', 'https://images.unsplash.com/photo-1523205771623-e0faa4d2813d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=89719a0d55dd05e2deae4120227e6efc&auto=format&fit=crop&w=1953&q=80', 'https://images.unsplash.com/photo-1508704019882-f9cf40e475b4?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8c6e5e3aba713b17aa1fe71ab4f0ae5b&auto=format&fit=crop&w=1352&q=80', 'https://images.unsplash.com/photo-1519985176271-adb1088fa94c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=a0c8d632e977f94e5d312d9893258f59&auto=format&fit=crop&w=1355&q=80' ]; @override Widget build(BuildContext context) { return SizedBox( width: double.infinity, height: double.infinity, child: Stack( children: <Widget>[ Center( child: CarouselSlider( options: CarouselOptions( autoPlay: true, height: 350, pauseAutoPlayOnTouch: true, viewportFraction: 1.0 ), items: imgList.map((i) { return Builder( builder: (BuildContext context) { return Container( width: MediaQuery.of(context).size.width, child: CachedNetworkImage( fit: BoxFit.cover, imageUrl: i, placeholder: (context, url) => Center( child: CircularProgressIndicator() ), errorWidget: (context, url, error) => new Icon(Icons.error), ) ); }, ); }).toList(), ), ), ], ), ); } }
0
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib
mirrored_repositories/Flutter-Open-Source-Apps/Flutter Open Source Apps/Advanced/flutter_eCommerce_ui_kit/lib/home/drawer.dart
import 'package:flutter/material.dart'; import 'package:flutter_ecommerce_ui_kit/blocks/auth_block.dart'; import 'package:provider/provider.dart'; class AppDrawer extends StatefulWidget { @override _AppDrawerState createState() => _AppDrawerState(); } class _AppDrawerState extends State<AppDrawer> { @override Widget build(BuildContext context) { AuthBlock auth = Provider.of<AuthBlock>(context); return Column( children: <Widget>[ if (auth.isLoggedIn) UserAccountsDrawerHeader( decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.cover, image: AssetImage('assets/images/drawer-header.jpg'), )), currentAccountPicture: CircleAvatar( backgroundImage: NetworkImage( 'https://avatars2.githubusercontent.com/u/2400215?s=120&v=4'), ), accountEmail: Text(auth.user['user_email']), accountName: Text(auth.user['user_display_name']), ), Expanded( child: ListView( shrinkWrap: true, children: <Widget>[ ListTile( leading: Icon(Icons.home, color: Theme.of(context).colorScheme.secondary), title: Text('Home'), onTap: () { Navigator.pop(context); }, ), ListTile( leading: Icon(Icons.shopping_basket, color: Theme.of(context).colorScheme.secondary), title: Text('Shop'), trailing: Text('New', style: TextStyle(color: Theme.of(context).primaryColor)), onTap: () { Navigator.pop(context); Navigator.pushNamed(context, '/shop'); }, ), ListTile( leading: Icon(Icons.category, color: Theme.of(context).colorScheme.secondary), title: Text('Categorise'), onTap: () { Navigator.pop(context); Navigator.pushNamed(context, '/categorise'); }, ), ListTile( leading: Icon(Icons.favorite, color: Theme.of(context).colorScheme.secondary), title: Text('My Wishlist'), trailing: Container( padding: const EdgeInsets.all(10.0), decoration: new BoxDecoration( shape: BoxShape.circle, color: Theme.of(context).primaryColor, ), child: Text('4', style: TextStyle(color: Colors.white, fontSize: 10.0)), ), onTap: () { Navigator.pop(context); Navigator.pushNamed(context, '/wishlist'); }, ), ListTile( leading: Icon(Icons.shopping_cart, color: Theme.of(context).colorScheme.secondary), title: Text('My Cart'), trailing: Container( padding: const EdgeInsets.all(10.0), decoration: new BoxDecoration( shape: BoxShape.circle, color: Theme.of(context).primaryColor, ), child: Text('2', style: TextStyle(color: Colors.white, fontSize: 10.0)), ), onTap: () { Navigator.pop(context); Navigator.pushNamed(context, '/cart'); }, ), ListTile( leading: Icon(Icons.lock, color: Theme.of(context).colorScheme.secondary), title: Text('Login'), onTap: () { Navigator.pop(context); Navigator.pushNamed(context, '/auth'); }, ), Divider(), ListTile( leading: Icon(Icons.settings, color: Theme.of(context).colorScheme.secondary), title: Text('Settings'), onTap: () { Navigator.pop(context); Navigator.pushNamed(context, '/settings'); }, ), ListTile( leading: Icon(Icons.exit_to_app, color: Theme.of(context).colorScheme.secondary), title: Text('Logout'), onTap: () async { await auth.logout(); }, ) ], ), ) ], ); } }
0