repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/uniMindeloApp/lib
mirrored_repositories/uniMindeloApp/lib/widgets/appBar.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:uni_mindelo/utils/constants/colors.dart'; class CustomAppbar extends StatelessWidget implements PreferredSizeWidget { final String title; final bool canBack; const CustomAppbar({Key? key, required this.title, required this.canBack}) : super(key: key); @override Size get preferredSize => Size.fromHeight(60.0); @override Widget build(BuildContext context) { return canBack ? AppBar( backgroundColor: AppBarColor, title: Text( title, style: GoogleFonts.lato(), ), leading: IconButton( icon: Icon(Icons.arrow_back, color: PrimaryBlackAssentColor), onPressed: () => Navigator.of(context).pop())) : AppBar( automaticallyImplyLeading: true, backgroundColor: AppBarColor, title: Text(title), ); } }
0
mirrored_repositories/uniMindeloApp/lib/utils
mirrored_repositories/uniMindeloApp/lib/utils/constants/paymentTitle.dart
const String payBribe = "Pagar Propina"; const String buyTicket = "Comprar Bilhete";
0
mirrored_repositories/uniMindeloApp/lib/utils
mirrored_repositories/uniMindeloApp/lib/utils/constants/colors.dart
import 'package:flutter/material.dart'; // CORES DA APP const PrimaryColor = Colors.lightBlueAccent; const PrimaryBlackAssentColor = Colors.black54; const PrimaryBlack = Colors.black; const AppBarColor = Colors.lightBlueAccent; const PrimaryWhiteAssentColor = Colors.white; const PrimaryGreyColor = Colors.grey; const isPaid = Colors.greenAccent; const isNotPaid = Colors.red; const gradesOK = Colors.lightBlueAccent; const gradesNOK = Colors.red; const bottomNavigationBarTheme = Colors.black87; const bottomNavigationBarThemeGray = Colors.grey; const drawerIconColor = Colors.black; const creditCardColor = Colors.grey; const creditCardColorBtPay = Colors.lightBlueAccent; const currentTimeCircleColor = Colors.blue;
0
mirrored_repositories/uniMindeloApp/lib/utils
mirrored_repositories/uniMindeloApp/lib/utils/constants/errors.dart
const String userDontExists = "user-not-found"; const String wrongPassword = "wrong-password"; const String tooManyRequests = "too-many-requests"; const String invalidEmail = "invalid-email";
0
mirrored_repositories/uniMindeloApp/lib/utils
mirrored_repositories/uniMindeloApp/lib/utils/services/launchUrlService.dart
import 'package:url_launcher/url_launcher.dart'; launchURL(pageUrl) async { if (await launch( pageUrl, enableDomStorage: true, )) { } else { throw 'Could not launch $pageUrl'; } }
0
mirrored_repositories/uniMindeloApp/lib/utils
mirrored_repositories/uniMindeloApp/lib/utils/services/loaderService.dart
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_translate/flutter_translate.dart'; import '../constants/colors.dart'; showLoader() { EasyLoading.instance ..indicatorType = EasyLoadingIndicatorType.chasingDots ..loadingStyle = EasyLoadingStyle.light ..indicatorSize = 60 ..radius = 20 ..backgroundColor = PrimaryWhiteAssentColor ..indicatorColor = PrimaryColor ..maskColor = PrimaryColor.withOpacity(0.5) ..userInteractions = false ..dismissOnTap = false; EasyLoading.show(status: translate('LOADER_TITLE')); } dismissLoader() { EasyLoading.dismiss(); }
0
mirrored_repositories/uniMindeloApp/lib/utils
mirrored_repositories/uniMindeloApp/lib/utils/services/storage.service.dart
import 'package:get_storage/get_storage.dart'; final storage = GetStorage(); const String user_uid = 'user_uid'; const String classId = "classId"; void saveData(key, value) { storage.write(key, value); } getData(key) { return storage.read(key); } void deleteData(key) { storage.remove(key); }
0
mirrored_repositories/uniMindeloApp/lib/utils
mirrored_repositories/uniMindeloApp/lib/utils/services/router.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:uni_mindelo/views/auth/forgotPassword/forgotPassword.dart'; import 'package:uni_mindelo/views/auth/login/login.dart'; import 'package:uni_mindelo/views/cineMindelo/cineMindelo.dart'; import 'package:uni_mindelo/views/classes/classes.dart'; import 'package:uni_mindelo/views/feed/feed.dart'; import 'package:uni_mindelo/views/grades/grades.dart'; import 'package:uni_mindelo/views/home/home.dart'; import 'package:uni_mindelo/views/payment/payments.dart'; import 'package:uni_mindelo/views/payment/paymentsList.dart'; const String loginRoute = '/'; const String forgorPassword = '/forgorPassword'; const String homeRoute = '/home'; const String gradesRoute = '/grades'; const String feedRoute = '/feed'; const String payment = '/payment'; const String classes = '/classes'; const String bribes = '/bribes'; const String cineMindelo = '/cineMindelo'; /* use with no arguments => Navigator.pushNamed(context, grades);*/ /* use with arguments => Navigator.pushNamed(context, grades, arguments: 'Data from grades'); */ /* get arguments => var data = settings.arguments; */ class AppRouter { static Route<dynamic> generateRoute(RouteSettings settings) { switch (settings.name) { case '/': return MaterialPageRoute(builder: (_) => Login()); case '/forgorPassword': return MaterialPageRoute(builder: (_) => ForgotPassword()); case '/home': return MaterialPageRoute(builder: (_) => Home()); case '/grades': var data = settings.arguments; return MaterialPageRoute(builder: (_) => Grades(userGrades: data)); case '/feed': return MaterialPageRoute(builder: (_) => Feed()); case '/classes': return MaterialPageRoute(builder: (_) => Classes()); case '/payment': var data = settings.arguments; return MaterialPageRoute(builder: (_) => Payment(title: data)); case '/bribes': return MaterialPageRoute(builder: (_) => Bribes()); case '/cineMindelo': return MaterialPageRoute(builder: (_) => CineMindelo()); default: return MaterialPageRoute( builder: (_) => Scaffold( body: Center( child: Text('No route defined for ${settings.name}')), )); } } }
0
mirrored_repositories/uniMindeloApp/lib/utils
mirrored_repositories/uniMindeloApp/lib/utils/services/dialogService.dart
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_translate/flutter_translate.dart'; // ignore: import_of_legacy_library_into_null_safe import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:uni_mindelo/utils/services/router.dart'; import '../constants/colors.dart'; // ignore: must_be_immutable class DialogService extends StatelessWidget { final String subTitle; final String title; bool dismissOnPopLogin; bool isCreditCard; DialogService( {required this.subTitle, required this.title, required this.dismissOnPopLogin, required this.isCreditCard}); dialogContent(BuildContext context) {} @override Widget build(BuildContext context) { return NetworkGiffyDialog( image: !isCreditCard ? Image.asset( "assets/images/loginBaseDialog.gif", fit: BoxFit.cover, ) : Image.asset( "assets/images/paymentInProcess.gif", fit: BoxFit.cover, ), entryAnimation: EntryAnimation.LEFT, title: Text( translate(title), textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), ), description: Text( translate(subTitle), textAlign: TextAlign.center, style: TextStyle(fontSize: 14.0), ), onlyCancelButton: true, buttonCancelText: Text(translate('DIALOG.DIALOG_BT.OK')), buttonCancelColor: PrimaryColor, onCancelButtonPressed: () { if (dismissOnPopLogin == true) { Navigator.pushNamed(context, loginRoute); } else { Navigator.pop(context, true); } }, /* onOkButtonPressed: () { Navigator.pop(context, true); }, */ ); } }
0
mirrored_repositories
mirrored_repositories/E-Commerce-App/main.dart
import 'package:flutter/material.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: 'Flutter', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(), ); } }
0
mirrored_repositories/Flutter-ui-ecomm
mirrored_repositories/Flutter-ui-ecomm/lib/theme.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; double defaultMargin = 30.0; Color primaryColor = Color(0xff6C5ECF); Color secondaryColor = Color(0xff38ABBE); Color alertColor = Color(0xffED6363); Color priceColor = Color(0xff2C96F1); Color backgroundColor1 = Color(0xff1F1D2B); Color backgroundColor2 = Color(0xff2B2937); Color backgroundColor3 = Color(0xff242231); Color backgroundColor4 = Color(0xff252836); Color backgroundColor5 = Color(0xff2B2844); Color backgroundColor6 = Color(0xffECEDEF); Color backgroundColorWhite = Color(0xffECEDEF); Color primaryTextColor = Color(0xffE1E1E1); Color secondaryTextColor = Color(0xff999999); Color subtitleColor = Color(0xff504F5E); Color whiteColor = Color(0xffF1F0F2); Color blackColor = Color(0xff2E2E2E); Color transparantColor = Colors.transparent; TextStyle primaryTextStyle = GoogleFonts.poppins( color: primaryTextColor, ); TextStyle secondaryTextStyle = GoogleFonts.poppins( color: secondaryTextColor, ); TextStyle subtitleTextStyle = GoogleFonts.poppins( color: subtitleColor, ); TextStyle priceTextStyle = GoogleFonts.poppins( color: priceColor, ); TextStyle purpelTextStyle = GoogleFonts.poppins( color: primaryColor, fontWeight: medium, ); TextStyle blackTextStyle = GoogleFonts.poppins( color: blackColor, fontWeight: semiBold, ); TextStyle alertTextStyle = GoogleFonts.poppins( color: alertColor, fontWeight: light, ); FontWeight light = FontWeight.w300; FontWeight reguler = FontWeight.w400; FontWeight medium = FontWeight.w500; FontWeight semiBold = FontWeight.w600; FontWeight bold = FontWeight.w700;
0
mirrored_repositories/Flutter-ui-ecomm
mirrored_repositories/Flutter-ui-ecomm/lib/main.dart
import 'package:flutter/material.dart'; import 'package:myshoe/screens/cart_screen.dart'; import 'package:myshoe/screens/checkout_screen.dart'; import 'package:myshoe/screens/checkout_success.dart'; import 'package:myshoe/screens/detail_chat_screen.dart'; import 'package:myshoe/screens/edit_profile_screen.dart'; import 'package:myshoe/screens/home/main_page.dart'; import 'package:myshoe/screens/detail_product_screen.dart'; import 'package:myshoe/screens/sign_up_screen.dart'; import 'package:myshoe/screens/sign_in_screen.dart'; import 'package:myshoe/screens/custom_splash_screen.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, routes: { '/': (context) => MyCustomSplashScreen(), '/sign-in': (context) => SignInScreen(), '/sign-up': (context) => SignUpScreen(), '/home': (context) => MainPage(), '/detail-chat': (context) => DetailChatPage(), '/edit-profile': (context) => EditProfileScreen(), '/product': (context) => ProductScreen(), '/cart': (context) => CartScreen(), '/checkout': (context) => CheckoutScreen(), '/checkout_success': (context) => CheckoutSuccess(), }, ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/widgets/chat_bubble.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:myshoe/theme.dart'; class ChatBubble extends StatelessWidget { final String text; final bool isSender; final bool hasProduct; ChatBubble( {Key? key, this.isSender = false, this.text = '', this.hasProduct = false}) : super(key: key); @override Widget build(BuildContext context) { Widget productPreview() { return Container( width: 232, margin: EdgeInsets.only(bottom: 12), padding: EdgeInsets.all(12), decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(isSender ? 12 : 0), topRight: Radius.circular(isSender ? 0 : 12), bottomRight: Radius.circular(12), bottomLeft: Radius.circular(12), ), color: isSender ? backgroundColor5 : backgroundColor4, ), child: Column( children: [ Row( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: Image.asset( 'assets/image_shoe.png', width: 70, ), ), SizedBox(width: 8), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'COURT VISION 2.0 SHOES', style: primaryTextStyle, ), SizedBox(height: 4), Text( '\$57,15', style: priceTextStyle, ) ], ), ), ], ), SizedBox(height: 20), Row( children: [ OutlinedButton( style: OutlinedButton.styleFrom( side: BorderSide( color: priceColor, ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), ), onPressed: () {}, child: Text('ADD TO CART', style: purpelTextStyle), ), SizedBox(width: 8), TextButton( style: TextButton.styleFrom( backgroundColor: primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), ), onPressed: () {}, child: Text( 'Buy Now', style: GoogleFonts.poppins( color: backgroundColor5, fontWeight: medium, ), ), ), ], ) ], ), ); } return Container( width: double.infinity, margin: EdgeInsets.only(top: 30), child: Column( crossAxisAlignment: isSender ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [ hasProduct ? productPreview() : SizedBox(), Row( mainAxisAlignment: isSender ? MainAxisAlignment.end : MainAxisAlignment.start, children: [ Flexible( child: Container( constraints: BoxConstraints( maxWidth: MediaQuery.of(context).size.width * 0.6, ), padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16), decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(isSender ? 12 : 0), topRight: Radius.circular(isSender ? 0 : 12), bottomRight: Radius.circular(12), bottomLeft: Radius.circular(12), ), color: isSender ? backgroundColor5 : backgroundColor4, ), child: Text( text, style: primaryTextStyle, ), ), ), ], ), ], ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/widgets/wishlist_buble.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class WishlistBubble extends StatelessWidget { const WishlistBubble({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 10, left: 12, bottom: 24, right: 20), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: backgroundColor4, ), child: Row( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: Image.asset( 'assets/image_shoe.png', width: 60, ), ), SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Predator 20.3 Firm Ground Boots', style: primaryTextStyle.copyWith(fontWeight: medium), ), SizedBox(height: 2), Text( '\$68,98', style: priceTextStyle, ) ], ), ), Image.asset('assets/icon_circle_favorite_active.png', width: 34), ], ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/widgets/checkout_card.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class CheckoutCard extends StatelessWidget { const CheckoutCard({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(top: 12), padding: EdgeInsets.symmetric(horizontal: 12, vertical: 20), decoration: BoxDecoration( color: backgroundColor4, borderRadius: BorderRadius.circular(12), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( width: 60, height: 60, decoration: BoxDecoration( color: backgroundColor3, borderRadius: BorderRadius.circular(12), image: DecorationImage( image: AssetImage('assets/image_shoe.png'), fit: BoxFit.cover, ), ), ), SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Terrex Urban Low Terrex Urban LowTerrex Urban LowTerrex Urban Low', style: primaryTextStyle.copyWith( fontWeight: semiBold, ), overflow: TextOverflow.ellipsis, ), SizedBox(height: 2), Text( '\$143,98', style: priceTextStyle.copyWith( fontWeight: reguler, ), ), ], ), ), SizedBox(width: 12), Text( '2 Items', style: subtitleTextStyle.copyWith( fontSize: 12, ), ), ], ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/widgets/product_card.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class ProductCard extends StatelessWidget { const ProductCard({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return GestureDetector( onTap: () { Navigator.pushNamed(context, '/product'); }, child: Container( margin: EdgeInsets.only(right: defaultMargin), width: 215, height: 278, decoration: BoxDecoration( color: backgroundColorWhite, borderRadius: BorderRadius.circular(20), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 30, ), Image.asset( 'assets/image_shoe.png', width: 215, height: 150, fit: BoxFit.cover, ), Container( padding: EdgeInsets.only(left: 20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Hiking', style: secondaryTextStyle.copyWith( fontSize: 12, ), ), SizedBox( height: 6.0, ), Text( 'COURT VISION 2.0', style: blackTextStyle.copyWith( fontSize: 18, fontWeight: semiBold, ), overflow: TextOverflow.ellipsis, ), SizedBox( height: 6.0, ), Text( '\$58,67', style: priceTextStyle.copyWith( fontSize: 14, fontWeight: medium, ), ), ], ), ), ], ), ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/widgets/cart_card.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class CartCard extends StatefulWidget { CartCard({Key? key}) : super(key: key); @override State<CartCard> createState() => _CartCardState(); } class _CartCardState extends State<CartCard> { int _counter = 0; void _incrementCounter() { setState(() { _counter++; }); } void _decrementCounter() { setState(() { if (_counter > 0) { _counter--; } }); } @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(top: defaultMargin), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10), decoration: BoxDecoration( color: backgroundColor4, borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.1), blurRadius: 10, spreadRadius: 5, ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: Image.asset( 'assets/image_shoe.png', width: 60, ), ), SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Terrex Urban Low', style: primaryTextStyle.copyWith( fontWeight: semiBold, ), ), SizedBox(height: 4), Text( '\$143,98', style: priceTextStyle, ), ], ), ), Column( children: [ GestureDetector( onTap: () { _incrementCounter(); }, child: Image.asset( 'assets/icon_add.png', width: 16, ), ), SizedBox(height: 4), Text( '$_counter', style: primaryTextStyle.copyWith(fontWeight: medium), ), SizedBox(height: 4), GestureDetector( onTap: () { _decrementCounter(); }, child: Image.asset('assets/icon_remove.png', width: 16), ), ], ), ], ), SizedBox(height: 12), Row( children: [ Expanded( child: Text( 'Size:', style: secondaryTextStyle.copyWith( fontWeight: medium, ), ), ), Text( 'M', style: primaryTextStyle.copyWith(fontWeight: medium), ), ], ), SizedBox(height: 12), Row( children: [ Image.asset('assets/icon_trash.png', width: 10), SizedBox(width: 4), Text( 'Remove', style: alertTextStyle.copyWith(fontSize: 12), ), ], ), ], ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/widgets/product_tile.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class ProductTile extends StatelessWidget { const ProductTile({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return GestureDetector( onTap: () { Navigator.pushNamed(context, '/product'); }, child: Container( margin: EdgeInsets.only( left: defaultMargin, right: defaultMargin, bottom: defaultMargin), child: Row( children: [ ClipRRect( borderRadius: BorderRadius.circular(20), child: Image.asset( 'assets/image_shoe.png', width: 120, height: 120, fit: BoxFit.cover, ), ), SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Football', style: secondaryTextStyle.copyWith( fontSize: 12, fontWeight: reguler, ), ), SizedBox(height: 6), Text( 'Predator 20.3 Firm Ground', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: semiBold, ), ), SizedBox(height: 6), Text( '\$68,47', style: priceTextStyle.copyWith( fontSize: 14, fontWeight: medium), ) ], ), ) ], ), ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/widgets/chat_tile.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class ChatTile extends StatelessWidget { const ChatTile({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return GestureDetector( onTap: () { Navigator.of(context).pushNamed('/detail-chat'); }, child: Container( margin: EdgeInsets.only(top: 33), child: Column( children: [ Row( children: [ Image.asset( 'assets/icon_store_shoe.png', width: 54, ), SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Shoe Store', style: primaryTextStyle.copyWith( fontSize: 15, ), ), Text( 'Good night, This item is on...', style: secondaryTextStyle.copyWith( fontSize: 14, fontWeight: light, ), overflow: TextOverflow.ellipsis, ), ], ), ), Text( 'Now', style: secondaryTextStyle.copyWith( fontSize: 10, ), ) ], ), SizedBox(height: 12), Divider( thickness: 1, color: Color(0xff2B2939), ), ], ), ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/sign_in_screen.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class SignInScreen extends StatelessWidget { const SignInScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { Widget header() { return SafeArea( child: Container( margin: EdgeInsets.only(top: 30.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Login', style: primaryTextStyle.copyWith( fontSize: 24, fontWeight: semiBold, ), ), SizedBox( height: 2, ), Text( 'Sign In to Continue', style: subtitleTextStyle, ) ], ), ), ); } Widget emailInput() { return Container( margin: EdgeInsets.only(top: 70.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Email Address', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox( height: 12.0, ), Container( height: 50.0, padding: EdgeInsets.symmetric(horizontal: 16.0), decoration: BoxDecoration( color: backgroundColor2, borderRadius: BorderRadius.circular(12), ), child: Center( child: Row( children: [ Image.asset( 'assets/icon_email.png', width: 17, ), SizedBox( width: 16.0, ), Expanded( child: TextFormField( style: primaryTextStyle, decoration: InputDecoration.collapsed( hintText: 'Your email Address', hintStyle: subtitleTextStyle, ), )) ], ), ), ), ], ), ); } Widget passwordInput() { return Container( margin: EdgeInsets.only(top: 20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Password', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox( height: 12.0, ), Container( height: 50.0, padding: EdgeInsets.symmetric(horizontal: 16.0), decoration: BoxDecoration( color: backgroundColor2, borderRadius: BorderRadius.circular(12), ), child: Center( child: Row( children: [ Image.asset( 'assets/icon_password.png', width: 17, ), SizedBox( width: 16.0, ), Expanded( child: TextFormField( style: primaryTextStyle, obscureText: true, decoration: InputDecoration.collapsed( hintText: 'Your Password', hintStyle: subtitleTextStyle, ), ), ) ], ), ), ), ], ), ); } Widget signInButton() { return Container( height: 50.0, width: double.infinity, margin: EdgeInsets.only(top: 30.0), child: TextButton( onPressed: () { Navigator.pushNamed(context, '/home'); }, style: TextButton.styleFrom( backgroundColor: primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), )), child: Text( "Sign In", style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), ), ); } Widget footer() { return Container( margin: EdgeInsets.only(bottom: 30.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Don\'t have an account? ', style: subtitleTextStyle.copyWith(fontSize: 12), ), GestureDetector( onTap: () => Navigator.pushNamed(context, '/sign-up'), child: Text('Sign Up', style: purpelTextStyle), ), ], ), ); } return Scaffold( backgroundColor: backgroundColor1, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( height: MediaQuery.of(context).size.height, margin: EdgeInsets.symmetric(horizontal: defaultMargin), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ header(), emailInput(), passwordInput(), signInButton(), Spacer(), footer(), ], ), ), )); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/checkout_screen.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; import '../widgets/checkout_card.dart'; class CheckoutScreen extends StatelessWidget { const CheckoutScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { PreferredSizeWidget header() { return AppBar( backgroundColor: backgroundColor1, elevation: 0, centerTitle: true, title: Text( 'Checkout Details', style: primaryTextStyle.copyWith(fontSize: 18, fontWeight: medium), ), ); } Widget content() { return ListView( padding: EdgeInsets.symmetric(horizontal: defaultMargin), children: [ // NOTE:LIST ITEMS Container( margin: EdgeInsets.only(top: defaultMargin), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'List Items', style: primaryTextStyle.copyWith( fontWeight: medium, fontSize: 16, ), ), SizedBox(height: 12), CheckoutCard(), CheckoutCard(), ], ), ), // NOTE : ADDRESS Container( margin: EdgeInsets.only(top: defaultMargin), padding: EdgeInsets.all(20), decoration: BoxDecoration( color: backgroundColor4, borderRadius: BorderRadius.circular(12), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Address Details', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox(height: 12), Row( children: [ Column( children: [ Image.asset( 'assets/icon_store_location.png', width: 40, ), Image.asset( 'assets/icon_line.png', height: 30, ), Image.asset( 'assets/icon_your_address.png', width: 40, ), ], ), SizedBox(width: 12), Column( children: [ Text( 'Store Location', style: subtitleTextStyle.copyWith( fontSize: 12, fontWeight: light, ), ), Text( 'Adidas Core', style: primaryTextStyle.copyWith( fontWeight: medium, ), ), SizedBox(height: defaultMargin), Text( 'Your Address', style: subtitleTextStyle.copyWith( fontSize: 12, fontWeight: light, ), ), Text( 'Marsemoon', style: primaryTextStyle.copyWith( fontWeight: medium, ), ), ], ), ], ), ], ), ), // NOTE: PAYMENT SUMMARY Container( margin: EdgeInsets.only(top: defaultMargin), padding: EdgeInsets.all(20), decoration: BoxDecoration( color: backgroundColor4, borderRadius: BorderRadius.circular(12), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Peyment Summary', style: primaryTextStyle.copyWith( fontWeight: medium, fontSize: 16), ), SizedBox(height: 12), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Product Quantity', style: secondaryTextStyle.copyWith( fontSize: 12, fontWeight: reguler, ), ), Text( '2 Items', style: primaryTextStyle.copyWith( fontWeight: medium, ), ), ], ), SizedBox(height: 12), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Product Price', style: secondaryTextStyle.copyWith( fontSize: 12, fontWeight: reguler, ), ), Text( '\$575.96', style: primaryTextStyle.copyWith( fontWeight: medium, ), ), ], ), SizedBox(height: 12), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Shipping', style: secondaryTextStyle.copyWith( fontSize: 12, fontWeight: reguler, ), ), Text( 'Free', style: primaryTextStyle.copyWith( fontWeight: medium, ), ), ], ), SizedBox(height: 11), Divider( color: Colors.grey, thickness: 0.2, ), SizedBox(height: 10), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Total', style: secondaryTextStyle.copyWith( fontSize: 12, fontWeight: reguler, ), ), Text( '\$575.96', style: priceTextStyle.copyWith( fontWeight: medium, ), ), ], ), ], ), ), // NOTE: BUTTON CHECKOUT SizedBox(height: defaultMargin), Divider( color: Colors.grey, thickness: 0.2, ), Container( height: 50, width: double.infinity, margin: EdgeInsets.symmetric(vertical: defaultMargin), child: TextButton( style: TextButton.styleFrom( backgroundColor: primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), onPressed: () { Navigator.pushNamedAndRemoveUntil( context, '/checkout_success', (route) => false); }, child: Text( 'Checkout Now', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: semiBold, ), ), ), ), ], ); } return Scaffold( backgroundColor: backgroundColor3, appBar: header(), body: content(), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/cart_screen.dart
import 'package:flutter/material.dart'; import '../theme.dart'; import '../widgets/cart_card.dart'; class CartScreen extends StatelessWidget { const CartScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { PreferredSizeWidget header() { return AppBar( backgroundColor: backgroundColor1, elevation: 0, centerTitle: true, title: Text( 'Your Cart', style: primaryTextStyle.copyWith(fontSize: 18, fontWeight: medium), ), ); } Widget emptyCart() { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( 'assets/image_cart.png', width: 80, ), SizedBox(height: 20), Text( 'Opss! Your Cart is Empty', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox(height: 12), Text( 'Let\'s find your favorite shoes', style: secondaryTextStyle, ), SizedBox(height: 20), Container( color: transparantColor, height: 44, child: GestureDetector( onTap: () { Navigator.pushNamedAndRemoveUntil( context, '/home', (route) => false); }, child: TextButton( onPressed: () {}, style: TextButton.styleFrom( padding: EdgeInsets.symmetric(vertical: 10, horizontal: 24), backgroundColor: primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), child: Text( 'Goo Shopping', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), ), ), ), ], ), ); } Widget customBottomNav() { return Container( height: 180, child: Column( children: [ Container( margin: EdgeInsets.symmetric(horizontal: defaultMargin), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Subtotal', style: primaryTextStyle.copyWith( fontWeight: reguler, ), ), Text( '\$287,96', style: priceTextStyle.copyWith( fontWeight: semiBold, fontSize: 16), ), ], ), ), SizedBox(height: 30), Divider( thickness: 0.3, color: Colors.grey, ), SizedBox(height: 30), Container( height: 50, margin: EdgeInsets.symmetric( horizontal: defaultMargin, ), child: TextButton( style: TextButton.styleFrom( padding: EdgeInsets.symmetric(vertical: 10, horizontal: 24), backgroundColor: primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), onPressed: () { Navigator.pushNamed(context, '/checkout'); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Continue to Checkout', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: semiBold), ), Icon( Icons.arrow_forward, color: primaryTextColor, ), ], ), ), ), ], ), ); } Widget content() { return ListView( padding: EdgeInsets.symmetric(horizontal: defaultMargin), children: [ CartCard(), CartCard(), ], ); } return Scaffold( appBar: header(), backgroundColor: backgroundColor3, body: content(), bottomNavigationBar: customBottomNav(), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/detail_chat_screen.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; import 'package:myshoe/widgets/chat_bubble.dart'; class DetailChatPage extends StatelessWidget { const DetailChatPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { PreferredSize header() { return PreferredSize( child: AppBar( backgroundColor: backgroundColor1, centerTitle: false, title: Row( children: [ Image.asset( 'assets/logo_shop_online.png', width: 50, ), SizedBox(width: 12), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Shoe Store', style: primaryTextStyle.copyWith( fontSize: 14, fontWeight: medium, ), ), Text( 'Online', style: secondaryTextStyle.copyWith( fontSize: 14, fontWeight: light, ), ), ], ) ], ), ), preferredSize: Size.fromHeight(80), ); } Widget productPreview() { return Container( width: 225, height: 74, margin: EdgeInsets.only(bottom: 20), padding: EdgeInsets.all(10), decoration: BoxDecoration( color: backgroundColor5, borderRadius: BorderRadius.circular(12), border: Border.all( color: priceColor, ), ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: Image.asset( 'assets/image_shoe.png', width: 54, ), ), SizedBox(width: 10), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'COURT VISIO...', overflow: TextOverflow.ellipsis, style: primaryTextStyle, ), SizedBox(height: 2), Text( '\$57,15', style: priceTextStyle, ), ], ), ), Image.asset( 'assets/button_close.png', width: 22, ), ], ), ); } Widget content() { return Expanded( child: ListView( padding: EdgeInsets.symmetric( horizontal: defaultMargin, ), children: [ ChatBubble( text: 'Hi, This item is still available?', isSender: true, hasProduct: true, ), ChatBubble( text: 'Good night, This item is only available in size 42 and 43', isSender: false, ), ChatBubble( text: 'Hi, This item is still available?', isSender: true, hasProduct: true, ), ChatBubble( text: 'Good night, This item is only available in size 42 and 43', isSender: false, ), ], ), ); } Widget chatInput() { return Container( margin: EdgeInsets.all(20), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ productPreview(), Row( children: [ Expanded( child: Container( height: 45, padding: EdgeInsets.symmetric(horizontal: 16), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: backgroundColor4, ), child: Center( child: TextFormField( decoration: InputDecoration.collapsed( hintText: 'Typle Message...', hintStyle: subtitleTextStyle, ), ), ), ), ), SizedBox(width: 20), Image.asset('assets/button_send.png', width: 45), ], ), ], ), ); } return Scaffold( backgroundColor: backgroundColor3, appBar: header(), body: SingleChildScrollView( child: Container( padding: EdgeInsets.only( top: defaultMargin, ), // height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height - header().preferredSize.height - defaultMargin, child: Column( children: [ content(), chatInput(), ], ), ), ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/checkout_success.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class CheckoutSuccess extends StatelessWidget { const CheckoutSuccess({Key? key}) : super(key: key); @override Widget build(BuildContext context) { PreferredSizeWidget header() { return AppBar( toolbarHeight: 87, backgroundColor: backgroundColor1, elevation: 0, automaticallyImplyLeading: false, centerTitle: true, title: Text( 'Checkout Success', style: primaryTextStyle.copyWith(fontSize: 18, fontWeight: medium), ), ); } Widget content() { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( 'assets/image_cart.png', height: 70, ), SizedBox(height: 20), Text( 'You made a transaction', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox(height: 12), Text( 'Stay at home while we \nprepare your dream shoes', style: secondaryTextStyle, textAlign: TextAlign.center, ), SizedBox(height: 30), Container( height: 44, width: 196, child: TextButton( onPressed: () { Navigator.pushNamedAndRemoveUntil( context, '/home', (route) => false); }, style: TextButton.styleFrom( backgroundColor: primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), child: Text( 'Order Other Shoes', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), ), ), SizedBox(height: 12), Container( height: 44, width: 196, child: TextButton( onPressed: () {}, style: TextButton.styleFrom( backgroundColor: Color(0xff39374B), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), child: Text( 'View My Order', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), ), ), ], ), ); } return Scaffold( backgroundColor: backgroundColor3, appBar: header(), body: content(), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/edit_profile_screen.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class EditProfileScreen extends StatelessWidget { const EditProfileScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { PreferredSizeWidget header() { return AppBar( backgroundColor: backgroundColor1, elevation: 0, leading: IconButton( onPressed: () { Navigator.pop(context); }, icon: Icon(Icons.close), ), centerTitle: true, title: Text( 'Edit Profile', ), actions: [ IconButton( icon: Icon( Icons.check, color: primaryColor, ), onPressed: () {}, ), ], ); } Widget nameInput() { return Container( margin: EdgeInsets.only(top: defaultMargin), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Name', style: secondaryTextStyle.copyWith( fontWeight: reguler, fontSize: 13, ), ), TextField( style: primaryTextStyle, decoration: InputDecoration( hintText: 'Valentino', hintStyle: primaryTextStyle, enabledBorder: UnderlineInputBorder( borderSide: BorderSide( color: subtitleColor, ), ), ), ), ], ), ); } Widget usernameInput() { return Container( margin: EdgeInsets.only(top: defaultMargin), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Username', style: secondaryTextStyle.copyWith( fontWeight: reguler, fontSize: 13, ), ), TextField( style: primaryTextStyle, decoration: InputDecoration( hintText: '@valentino', hintStyle: primaryTextStyle, enabledBorder: UnderlineInputBorder( borderSide: BorderSide( color: subtitleColor, ), ), ), ), ], ), ); } Widget emailInput() { return Container( margin: EdgeInsets.only(top: defaultMargin), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Email', style: secondaryTextStyle.copyWith( fontWeight: reguler, fontSize: 13, ), ), TextField( style: primaryTextStyle, decoration: InputDecoration( hintText: '[email protected]', hintStyle: primaryTextStyle, enabledBorder: UnderlineInputBorder( borderSide: BorderSide( color: subtitleColor, ), ), ), ), ], ), ); } Widget content() { return Container( width: double.infinity, padding: EdgeInsets.symmetric(horizontal: defaultMargin), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: 100, height: 100, margin: EdgeInsets.only( top: defaultMargin, ), decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( image: AssetImage( 'assets/image_profile.png', ), ), ), ), nameInput(), usernameInput(), emailInput(), ], ), ); } return Scaffold( backgroundColor: backgroundColor3, appBar: header(), body: content(), resizeToAvoidBottomInset: false, ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/custom_splash_screen.dart
import 'dart:async'; import 'package:myshoe/theme.dart'; import 'package:flutter/material.dart'; class MyCustomSplashScreen extends StatefulWidget { const MyCustomSplashScreen({Key? key}) : super(key: key); @override _MyCustomSplashScreenState createState() => _MyCustomSplashScreenState(); } class _MyCustomSplashScreenState extends State<MyCustomSplashScreen> with TickerProviderStateMixin { double _fontSize = 2; double _containerSize = 1.5; double _textOpacity = 0.0; double _containerOpacity = 0.0; late AnimationController _controller; late Animation<double> animation1; @override void initState() { super.initState(); _controller = AnimationController(vsync: this, duration: Duration(seconds: 3)); animation1 = Tween<double>(begin: 40, end: 20).animate(CurvedAnimation( parent: _controller, curve: Curves.fastLinearToSlowEaseIn)) ..addListener(() { setState(() { _textOpacity = 1.0; }); }); _controller.forward(); Timer(Duration(seconds: 2), () { setState(() { _fontSize = 1.06; }); }); Timer(Duration(seconds: 2), () { setState(() { _containerSize = 2; _containerOpacity = 1; }); }); Timer(Duration(seconds: 4), () { setState(() { Timer(Duration(seconds: 1), () => Navigator.pushNamed(context, '/sign-in')); }); }); } @override void dispose() { _controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { double _width = MediaQuery.of(context).size.width; double _height = MediaQuery.of(context).size.height; return Scaffold( backgroundColor: backgroundColor1, body: Stack( children: [ Column( children: [ AnimatedContainer( duration: Duration(milliseconds: 2000), curve: Curves.fastLinearToSlowEaseIn, height: _height / _fontSize), AnimatedOpacity( duration: Duration(milliseconds: 1000), opacity: _textOpacity, child: Text( 'My Shoe', style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: animation1.value, ), ), ), ], ), Center( child: AnimatedOpacity( duration: Duration(milliseconds: 2000), curve: Curves.fastLinearToSlowEaseIn, opacity: _containerOpacity, child: AnimatedContainer( duration: Duration(milliseconds: 2000), curve: Curves.fastLinearToSlowEaseIn, height: _width / _containerSize, width: _width / _containerSize, alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(30), ), child: Image.asset('assets/icon_splash.png'), ), ), ), ], ), ); } } class PageTransition extends PageRouteBuilder { final Widget page; PageTransition(this.page) : super( pageBuilder: (context, animation, anotherAnimation) => page, transitionDuration: Duration(milliseconds: 2000), transitionsBuilder: (context, animation, anotherAnimation, child) { animation = CurvedAnimation( curve: Curves.fastLinearToSlowEaseIn, parent: animation, ); return Align( alignment: Alignment.bottomCenter, child: SizeTransition( sizeFactor: animation, child: page, axisAlignment: 0, ), ); }, ); } class SecondPage extends StatelessWidget { const SecondPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/detail_product_screen.dart
import 'package:carousel_slider/carousel_slider.dart'; import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class ProductScreen extends StatefulWidget { ProductScreen({Key? key}) : super(key: key); @override State<ProductScreen> createState() => _ProductScreenState(); } class _ProductScreenState extends State<ProductScreen> { List items = [ 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png' ]; List familiarShoe = [ 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png', 'assets/image_shoe.png', ]; int currrentIndex = 0; bool isFavorite = false; @override Widget build(BuildContext context) { Future<void> showSuccessDialog() async { return showDialog<void>( context: context, builder: (BuildContext contex) => Container( width: MediaQuery.of(context).size.width - (2 * defaultMargin), child: AlertDialog( backgroundColor: backgroundColor3, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), ), content: SingleChildScrollView( child: Column( children: [ GestureDetector( onTap: () { Navigator.pop(context); }, child: Align( alignment: Alignment.centerLeft, child: Icon( Icons.close, color: primaryTextColor, ), ), ), Image.asset( 'assets/icon_success.png', width: 100, ), SizedBox(height: 12), Text( 'Success', style: primaryTextStyle.copyWith( fontWeight: semiBold, fontSize: 18), ), SizedBox(height: 12), Text( 'Item added successfully', style: secondaryTextStyle.copyWith( fontWeight: reguler, fontSize: 14, ), ), SizedBox(height: 20), Container( height: 44, width: 154, child: TextButton( onPressed: () {}, style: TextButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), backgroundColor: primaryColor, ), child: GestureDetector( onTap: () { Navigator.pushNamed(context, '/cart'); }, child: Text( 'View My Cart', style: primaryTextStyle.copyWith( fontWeight: medium, fontSize: 16, ), ), ), ), ), ], ), ), ), ), ); } Widget indicator(int index) { return Container( width: currrentIndex == index ? 16 : 4, height: 4, margin: EdgeInsets.symmetric(horizontal: 2), decoration: BoxDecoration( color: currrentIndex == index ? primaryColor : subtitleColor, borderRadius: BorderRadius.circular(10), ), ); } Widget header() { int index = -1; return Column( children: [ Container( padding: EdgeInsets.only( top: 20, left: defaultMargin, right: defaultMargin), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( onTap: () => Navigator.pop(context), child: Icon(Icons.chevron_left), ), Icon( Icons.shopping_bag, color: backgroundColor1, ), ], ), ), CarouselSlider( items: items .map( (image) => Image.asset( image, width: MediaQuery.of(context).size.width, height: 310, fit: BoxFit.cover, ), ) .toList(), options: CarouselOptions( initialPage: 0, onPageChanged: (index, reason) { setState(() { currrentIndex = index; }); }, ), ), SizedBox(height: 20), Row( mainAxisAlignment: MainAxisAlignment.center, children: items.map((e) { index++; return indicator(index); }).toList(), ), ], ); } Widget familiarCard(String imageUrl) { return Container( width: 54, height: 54, margin: EdgeInsets.only(right: 16), decoration: BoxDecoration( image: DecorationImage( image: AssetImage(imageUrl), ), borderRadius: BorderRadius.circular(6), ), ); } Widget content() { int index = -1; return Container( margin: EdgeInsets.only(top: 17), width: double.infinity, decoration: BoxDecoration( color: backgroundColor1, borderRadius: BorderRadius.vertical( top: Radius.circular(24), ), ), child: Column( children: [ // NOTE: HEADER Container( margin: EdgeInsets.only( top: defaultMargin, left: defaultMargin, right: defaultMargin, ), child: Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Nike Air Max', style: primaryTextStyle.copyWith( fontSize: 18, fontWeight: semiBold, ), ), SizedBox(height: 10), Text( 'Hiking', style: secondaryTextStyle, ) ], ), ), GestureDetector( onTap: () => setState(() { isFavorite = !isFavorite; if (isFavorite) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( backgroundColor: secondaryColor, content: Text( 'Has been added to the Favorite', textAlign: TextAlign.center, ), ), ); } else { ScaffoldMessenger.of(context).showSnackBar( SnackBar( backgroundColor: alertColor, content: Text( 'Has been added to the Favorite', textAlign: TextAlign.center, ), ), ); } }), child: Image.asset( isFavorite ? 'assets/icon_circle_favorite_red.png' : 'assets/icon_circle_favorite.png', width: 46, ), ), ], ), ), // NOTE: PRICE Container( margin: EdgeInsets.only( top: 20, left: defaultMargin, right: defaultMargin, ), padding: EdgeInsets.all(16), decoration: BoxDecoration( color: backgroundColor2, borderRadius: BorderRadius.circular(4), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Price starts from', style: primaryTextStyle, ), Text( '\$143,98', style: priceTextStyle.copyWith( fontWeight: semiBold, fontSize: 16, ), ) ], ), ), //NOTE : DESCRIPTION Container( margin: EdgeInsets.only( top: defaultMargin, left: defaultMargin, right: defaultMargin, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Description', style: primaryTextStyle.copyWith( fontWeight: medium, ), ), SizedBox(height: 12), Text( 'Unpaved trails and mixed surfaces are easy when you have the traction and support you need. Casual enough for the daily commute.', style: subtitleTextStyle.copyWith( fontWeight: light, ), textAlign: TextAlign.justify, ) ], ), ), // NOTE: SLIDER Container( width: double.infinity, margin: EdgeInsets.only(top: defaultMargin), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.symmetric( horizontal: defaultMargin, ), child: Text( 'Fimiliar Shoes', style: primaryTextStyle.copyWith( fontWeight: medium, ), ), ) ], ), ), SizedBox(height: 12), SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: familiarShoe.map((image) { index++; return Container( margin: EdgeInsets.only(left: index == 0 ? defaultMargin : 0), child: familiarCard(image), ); }).toList(), ), ), //NOTE : BUTTON Container( width: double.infinity, margin: EdgeInsets.all(defaultMargin), child: Row( children: [ GestureDetector( onTap: () => {Navigator.pushNamed(context, '/detail-chat')}, child: Container( width: 54, height: 54, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/button_chat.png'), ), ), ), ), SizedBox(width: 16), Expanded( child: Container( height: 54, child: TextButton( onPressed: () { showSuccessDialog(); }, style: TextButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), backgroundColor: primaryColor, ), child: Text( 'Add to Cart', style: primaryTextStyle.copyWith( fontWeight: semiBold, ), ), ), ), ) ], ), ), ], ), ); } return Scaffold( backgroundColor: backgroundColor6, body: ListView( children: [ header(), content(), ], ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/sign_up_screen.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class SignUpScreen extends StatelessWidget { const SignUpScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { Widget header() { return SafeArea( child: Container( margin: EdgeInsets.only(top: 30.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Sign Up', style: primaryTextStyle.copyWith( fontSize: 24, fontWeight: semiBold, ), ), SizedBox( height: 2, ), Text( 'Register and Happy Shoping', style: subtitleTextStyle, ) ], ), ), ); } Widget fullNameInput() { return Container( margin: EdgeInsets.only(top: 50.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Full Name', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox( height: 12.0, ), Container( height: 50.0, padding: EdgeInsets.symmetric(horizontal: 16.0), decoration: BoxDecoration( color: backgroundColor2, borderRadius: BorderRadius.circular(12), ), child: Center( child: Row( children: [ Image.asset( 'assets/icon_full_name.png', width: 17, ), SizedBox( width: 16.0, ), Expanded( child: TextFormField( style: primaryTextStyle, decoration: InputDecoration.collapsed( hintText: 'Your Full Name', hintStyle: subtitleTextStyle, ), )) ], ), ), ), ], ), ); } Widget usernameInput() { return Container( margin: EdgeInsets.only(top: 20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Username', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox( height: 12.0, ), Container( height: 50.0, padding: EdgeInsets.symmetric(horizontal: 16.0), decoration: BoxDecoration( color: backgroundColor2, borderRadius: BorderRadius.circular(12), ), child: Center( child: Row( children: [ Image.asset( 'assets/icon_username.png', width: 17, ), SizedBox( width: 16.0, ), Expanded( child: TextFormField( style: primaryTextStyle, decoration: InputDecoration.collapsed( hintText: 'Your Username', hintStyle: subtitleTextStyle, ), )) ], ), ), ), ], ), ); } Widget emailInput() { return Container( margin: EdgeInsets.only(top: 20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Email Address', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox( height: 12.0, ), Container( height: 50.0, padding: EdgeInsets.symmetric(horizontal: 16.0), decoration: BoxDecoration( color: backgroundColor2, borderRadius: BorderRadius.circular(12), ), child: Center( child: Row( children: [ Image.asset( 'assets/icon_email.png', width: 17, ), SizedBox( width: 16.0, ), Expanded( child: TextFormField( style: primaryTextStyle, decoration: InputDecoration.collapsed( hintText: 'Your email Address', hintStyle: subtitleTextStyle, ), )) ], ), ), ), ], ), ); } Widget passwordInput() { return Container( margin: EdgeInsets.only(top: 20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Password', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox( height: 12.0, ), Container( height: 50.0, padding: EdgeInsets.symmetric(horizontal: 16.0), decoration: BoxDecoration( color: backgroundColor2, borderRadius: BorderRadius.circular(12), ), child: Center( child: Row( children: [ Image.asset( 'assets/icon_password.png', width: 17, ), SizedBox( width: 16.0, ), Expanded( child: TextFormField( style: primaryTextStyle, obscureText: true, decoration: InputDecoration.collapsed( hintText: 'Your Password', hintStyle: subtitleTextStyle, ), ), ) ], ), ), ), ], ), ); } Widget signUpButton() { return Container( height: 50.0, width: double.infinity, margin: EdgeInsets.only(top: 30.0), child: TextButton( onPressed: () { Navigator.pushNamed(context, '/home'); }, style: TextButton.styleFrom( backgroundColor: primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), )), child: Text( "Sign Up", style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), ), ); } Widget footer() { return Container( margin: EdgeInsets.only(bottom: 30.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Already have an account? ', style: subtitleTextStyle.copyWith(fontSize: 12), ), GestureDetector( onTap: () => Navigator.pushNamed(context, '/sign-in'), child: Text('Sign In', style: purpelTextStyle), ), ], ), ); } return Scaffold( backgroundColor: backgroundColor1, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( height: MediaQuery.of(context).size.height, margin: EdgeInsets.symmetric(horizontal: defaultMargin), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ header(), fullNameInput(), usernameInput(), emailInput(), passwordInput(), signUpButton(), Spacer(), footer(), ], ), ), )); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib
mirrored_repositories/Flutter-ui-ecomm/lib/screens/splash_screen.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class SplashScreen extends StatefulWidget { SplashScreen({Key? key}) : super(key: key); @override State<SplashScreen> createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> { @override void initState() { Timer(Duration(seconds: 3), () => Navigator.pushNamed(context, '/sign-in')); super.initState(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: backgroundColor1, body: Center( child: Container( width: 130, height: 150, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/icon_splash.png'), ), ), ), ), ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib/screens
mirrored_repositories/Flutter-ui-ecomm/lib/screens/home/wishlist_page.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; import 'package:myshoe/widgets/wishlist_buble.dart'; class WishlistPage extends StatelessWidget { const WishlistPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { Widget header() { return AppBar( backgroundColor: backgroundColor1, title: Text('Favorite Items'), centerTitle: true, automaticallyImplyLeading: false, ); } Widget emptyWishlist() { return Expanded( child: Container( width: double.infinity, color: backgroundColor3, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( 'assets/image_wishlist.png', width: 75, ), SizedBox(height: 23), Text( 'You dont have any favorite items yet.', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox(height: 12), Text( 'Let\'s find your favorite shoes', style: secondaryTextStyle, ), SizedBox(height: 20), Container( height: 44, child: TextButton( style: TextButton.styleFrom( padding: EdgeInsets.symmetric( vertical: 10, horizontal: 24, ), backgroundColor: primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), onPressed: () {}, child: Text( 'Explore Store', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), ), ) ], ), ), ); } Widget content() { return Expanded( child: Container( color: backgroundColor3, child: ListView( padding: EdgeInsets.symmetric(horizontal: defaultMargin), children: [ WishlistBubble(), WishlistBubble(), WishlistBubble(), ], ), ), ); } return Column( children: [ header(), emptyWishlist(), // content(), ], ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib/screens
mirrored_repositories/Flutter-ui-ecomm/lib/screens/home/chat.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; import 'package:myshoe/widgets/chat_tile.dart'; class ChatPage extends StatelessWidget { const ChatPage({Key? key}) : super(key: key); Widget header() { return AppBar( backgroundColor: backgroundColor1, elevation: 0, centerTitle: true, automaticallyImplyLeading: false, title: Text( 'Message Support', style: primaryTextStyle.copyWith(fontSize: 18, fontWeight: medium), ), ); } Widget emptyChat() { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( 'assets/image_message.png', width: 80, ), SizedBox(height: 20), Text( 'Opss no message yet?', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), SizedBox(height: 12), Text( 'You have never done a transaction', style: secondaryTextStyle, ), SizedBox(height: 20), Container( color: transparantColor, height: 44, child: TextButton( onPressed: () {}, style: TextButton.styleFrom( padding: EdgeInsets.symmetric(vertical: 10, horizontal: 24), backgroundColor: primaryColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), ), child: Text( 'Explore Store', style: primaryTextStyle.copyWith( fontSize: 16, fontWeight: medium, ), ), ), ), ], ); } Widget content() { return Expanded( child: Container( width: double.infinity, color: backgroundColor3, child: ListView( padding: EdgeInsets.symmetric(horizontal: defaultMargin), children: [ ChatTile(), ], ), ), ); } @override Widget build(BuildContext context) { return Column( children: [ header(), content(), ], ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib/screens
mirrored_repositories/Flutter-ui-ecomm/lib/screens/home/profile_page.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; class ProfilePage extends StatelessWidget { const ProfilePage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { Widget header() { return AppBar( backgroundColor: backgroundColor1, automaticallyImplyLeading: false, elevation: 0, flexibleSpace: SafeArea( child: Container( padding: EdgeInsets.all(defaultMargin), child: Row( children: [ Image.asset( 'assets/image_profile.png', width: 64, ), SizedBox(width: 16), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Hallo, Valdo', style: primaryTextStyle.copyWith( fontSize: 24, fontWeight: semiBold, ), ), Text( '@xxrev', style: subtitleTextStyle.copyWith(fontSize: 16), ) ], ), ), GestureDetector( onTap: () { Navigator.pushNamedAndRemoveUntil( context, '/sign-in', (route) => false); }, child: Image.asset( 'assets/icon_exit.png', width: 20, ), ), ], ), )), ); } Widget menuItems(String text) { return Container( padding: EdgeInsets.only(top: 16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( text, style: secondaryTextStyle.copyWith( fontWeight: reguler, fontSize: 13, ), ), Icon( Icons.chevron_right, color: primaryTextColor, ), ], ), ); } Widget content() { return Expanded( child: Container( padding: EdgeInsets.symmetric(horizontal: defaultMargin), width: double.infinity, decoration: BoxDecoration( color: backgroundColor3, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 20), Text( 'Account', style: primaryTextStyle.copyWith( fontWeight: semiBold, fontSize: 16), ), GestureDetector( onTap: () { Navigator.pushNamed(context, '/edit-profile'); }, child: menuItems( 'Edit Profile', ), ), menuItems('Your Orders'), menuItems('Help'), SizedBox(height: 30), Text( 'General', style: primaryTextStyle.copyWith( fontWeight: semiBold, fontSize: 16), ), menuItems('Privacy & Policy'), menuItems('Term of Service'), menuItems('Rate App'), ], ), ), ); } return Column( children: [ header(), content(), ], ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib/screens
mirrored_repositories/Flutter-ui-ecomm/lib/screens/home/home.dart
import 'package:flutter/material.dart'; import 'package:myshoe/theme.dart'; import 'package:myshoe/widgets/product_card.dart'; import 'package:myshoe/widgets/product_tile.dart'; class HomePage extends StatelessWidget { const HomePage({Key? key}) : super(key: key); Widget header() { return Container( margin: EdgeInsets.only( top: defaultMargin, left: defaultMargin, right: defaultMargin, ), child: Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Hi, Valdo', style: primaryTextStyle.copyWith( fontSize: 24, fontWeight: semiBold, ), ), Text( '@xxrev', style: subtitleTextStyle.copyWith( fontSize: 16, ), ) ], ), ), Container( width: 44, height: 54, decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( image: AssetImage('assets/image_profile.png'), ), ), ), ], ), ); } Widget categories() { return SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ Container( margin: EdgeInsets.only( top: defaultMargin, left: defaultMargin, ), padding: EdgeInsets.symmetric( vertical: 10, horizontal: 12, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: primaryColor, ), child: Text( 'All Shoes', style: primaryTextStyle.copyWith( fontSize: 13, fontWeight: medium, ), ), ), Container( margin: EdgeInsets.only( top: defaultMargin, left: 16, ), padding: EdgeInsets.symmetric( vertical: 10, horizontal: 12, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: transparantColor, border: Border.all( color: subtitleColor, )), child: Text( 'Running', style: primaryTextStyle.copyWith( fontSize: 13, fontWeight: medium, ), ), ), Container( margin: EdgeInsets.only( top: defaultMargin, left: 16, ), padding: EdgeInsets.symmetric( vertical: 10, horizontal: 12, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: transparantColor, border: Border.all( color: subtitleColor, )), child: Text( 'Training', style: primaryTextStyle.copyWith( fontSize: 13, fontWeight: medium, ), ), ), Container( margin: EdgeInsets.only( top: defaultMargin, left: 16, ), padding: EdgeInsets.symmetric( vertical: 10, horizontal: 12, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: transparantColor, border: Border.all( color: subtitleColor, )), child: Text( 'Basketball', style: primaryTextStyle.copyWith( fontSize: 13, fontWeight: medium, ), ), ), Container( margin: EdgeInsets.only( top: defaultMargin, left: 16, ), padding: EdgeInsets.symmetric( vertical: 10, horizontal: 12, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: transparantColor, border: Border.all( color: subtitleColor, )), child: Text( 'Hiking', style: primaryTextStyle.copyWith( fontSize: 13, fontWeight: medium, ), ), ), ], ), ); } Widget popularProductsTitle() { return Container( // width: 192, margin: EdgeInsets.only( top: defaultMargin, left: defaultMargin, ), child: Text( 'Popular', style: primaryTextStyle.copyWith( fontSize: 22, fontWeight: semiBold, ), ), ); } Widget popularProducts() { return Container( margin: EdgeInsets.only(top: 14), child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ SizedBox( width: defaultMargin, ), Row( children: [ ProductCard(), ProductCard(), ProductCard(), ], ), ], ), ), ); } Widget newArrivalsTitle() { return Container( margin: EdgeInsets.only( top: defaultMargin, left: defaultMargin, right: defaultMargin, ), child: Text( 'New Product', style: primaryTextStyle.copyWith( fontSize: 22, fontWeight: semiBold, ), ), ); } Widget newArrivals() { return Container( margin: EdgeInsets.only(top: 14), child: Column( children: [ ProductTile(), ProductTile(), ProductTile(), ProductTile(), ], ), ); } @override Widget build(BuildContext context) { return ListView( children: [ header(), categories(), popularProductsTitle(), popularProducts(), newArrivalsTitle(), newArrivals(), ], ); } }
0
mirrored_repositories/Flutter-ui-ecomm/lib/screens
mirrored_repositories/Flutter-ui-ecomm/lib/screens/home/main_page.dart
import 'package:flutter/material.dart'; import 'package:myshoe/screens/home/chat.dart'; import 'package:myshoe/screens/home/home.dart'; import 'package:myshoe/screens/home/profile_page.dart'; import 'package:myshoe/screens/home/wishlist_page.dart'; import 'package:myshoe/theme.dart'; class MainPage extends StatefulWidget { const MainPage({Key? key}) : super(key: key); @override State<MainPage> createState() => _MainPageState(); } class _MainPageState extends State<MainPage> { int currentIndex = 0; @override Widget build(BuildContext context) { Widget buttonCart() { return FloatingActionButton( backgroundColor: secondaryColor, onPressed: () { Navigator.pushNamed(context, '/cart'); }, child: Image.asset( 'assets/icon_cart_white.png', width: 20, ), ); } Widget customBottomNav() { return ClipRRect( borderRadius: BorderRadius.vertical( top: Radius.circular(30), ), child: BottomAppBar( shape: CircularNotchedRectangle(), notchMargin: 13, clipBehavior: Clip.antiAlias, child: BottomNavigationBar( currentIndex: currentIndex, onTap: (value) { setState(() { currentIndex = value; }); }, backgroundColor: backgroundColor4, type: BottomNavigationBarType.fixed, items: [ BottomNavigationBarItem( icon: Container( margin: EdgeInsets.only(top: 20, bottom: 10), child: Image.asset( 'assets/icon_home.png', color: currentIndex == 0 ? primaryColor : Color(0xff808191), width: 21, ), ), label: '', ), BottomNavigationBarItem( icon: Container( margin: EdgeInsets.only(top: 20, bottom: 10), child: Image.asset( 'assets/icon_chat.png', color: currentIndex == 1 ? primaryColor : Color(0xff808191), width: 20, ), ), label: '', ), BottomNavigationBarItem( icon: Container( margin: EdgeInsets.only(top: 20, bottom: 10), child: Image.asset( 'assets/icon_favorite.png', color: currentIndex == 2 ? primaryColor : Color(0xff808191), width: 20, ), ), label: '', ), BottomNavigationBarItem( icon: Container( margin: EdgeInsets.only(top: 20, bottom: 10), child: Image.asset( 'assets/icon_profile.png', color: currentIndex == 3 ? primaryColor : Color(0xff808191), width: 18, ), ), label: '', ), ], ), ), ); } Widget body() { switch (currentIndex) { case 0: return HomePage(); case 1: return ChatPage(); case 2: return WishlistPage(); case 3: return ProfilePage(); default: return HomePage(); } } return Scaffold( floatingActionButton: buttonCart(), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, bottomNavigationBar: customBottomNav(), backgroundColor: currentIndex == 0 ? backgroundColor1 : backgroundColor3, body: body(), ); } }
0
mirrored_repositories/Flutter-ui-ecomm
mirrored_repositories/Flutter-ui-ecomm/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:myshoe/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/Grocery-UI-with-SearchingSorting-Algo/agriday
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib/datamodel.dart
class Fruit { String? seller; String? product; String? variety; int? price; int? avgweight; int? perbox; int? boxes; String? delivery; Fruit( {this.seller, this.product, this.variety, this.price, this.avgweight, this.perbox, this.boxes, this.delivery}); Fruit.fromJson(Map<String, dynamic> json) { seller = json['Seller']; product = json['Product']; variety = json['Variety']; price = json['Price']; avgweight = json['AvgWeight']; perbox = json['PerBox']; boxes = json['Boxes']; delivery = json['Delivery']; } }
0
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib/chat.dart
import 'package:agriday/widgets/messagein.dart'; import 'package:agriday/widgets/messageout.dart'; import 'package:flutter/material.dart'; class Chat extends StatefulWidget { String? seller; String? product; String? variety; int? price; int? avgweight; int? perbox; int? boxes; String? delivery; Chat(this.seller, this.product, this.variety, this.price, this.avgweight, this.perbox, this.boxes, this.delivery, {Key? key}) : super(key: key); List<String> messages = <String>["How fast can you deliver?"]; @override State<Chat> createState() => _ChatState(); } class _ChatState extends State<Chat> { @override Widget build(BuildContext context) { TextEditingController _controller = TextEditingController(); return Scaffold( backgroundColor: const Color(0xffE5E5E5), appBar: AppBar( backgroundColor: Colors.white, title: Align( alignment: Alignment.centerLeft, child: Text( widget.seller.toString(), style: const TextStyle(color: Colors.black), ), ), leading: IconButton( icon: const Icon( Icons.arrow_back_ios, ), color: Colors.black, onPressed: () { Navigator.pop(context); }, ), ), body: SingleChildScrollView( child: Column( children: [ const Padding( padding: EdgeInsets.all(8.0), child: Align( alignment: Alignment.centerLeft, child: Text("Lot Details", style: TextStyle( color: Colors.black, fontSize: 22, fontWeight: FontWeight.bold)), ), ), Padding( padding: const EdgeInsets.all(8.0), child: ClipRRect( borderRadius: BorderRadius.circular(10), child: SizedBox( height: 180, child: Column( children: [ Expanded( flex: 2, child: Container( color: Colors.white, child: Align( alignment: Alignment.centerLeft, child: Padding( padding: const EdgeInsets.all(8.0), child: Text( widget.seller.toString(), style: const TextStyle(fontSize: 15), ), )), ), ), Expanded( flex: 5, child: Container( child: Align( alignment: Alignment.centerLeft, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( children: [ Text( widget.product.toString(), style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 20), ), const Text( "Product", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), Column( children: [ Text( widget.avgweight.toString(), style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 20), ), const Text( "avg weight", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), ], ), Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( children: [ Text( widget.variety.toString(), style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 20), ), const Text( "Variety", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), Column( children: [ Text( widget.perbox.toString() + "kg", style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 20), ), const Text( "per Box", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), ], ), Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ ClipRRect( borderRadius: BorderRadius.circular(20), child: Container( height: 30, width: 100, color: const Color( // ignore: use_full_hex_values_for_flutter_colors 0xff21212114), child: Align( alignment: Alignment.center, child: Text( "₹" + widget.price.toString(), style: const TextStyle( color: Color(0xff27AE60), fontSize: 20), ), ), ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: [ Text( widget.boxes.toString(), style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 20), ), const Text( "Boxes", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), const SizedBox( width: 25, ), Column( children: [ Text( widget.boxes.toString(), style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 20), ), const Text( "Delivery", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), ], ), ], ), ], )), color: const Color(0xFFF4F4DD), ), ), ], ), ), ), ), MessageIn("Hello Buyer we have " + widget.product.toString() + " ready to ship"), MessageIn("Do let me know"), ListView.builder( itemCount: widget.messages.length, scrollDirection: Axis.vertical, shrinkWrap: true, itemBuilder: (context, index) { return MessageOut(widget.messages[index]); }) ], ), ), bottomNavigationBar: BottomAppBar( child: Row( children: <Widget>[ const SizedBox( width: 15, height: 55, ), Expanded( child: TextField( controller: _controller, decoration: const InputDecoration( contentPadding: EdgeInsets.all(3), hintText: "Message", hintStyle: TextStyle(color: Colors.black54), border: InputBorder.none), ), ), const SizedBox( width: 15, ), ClipRRect( borderRadius: BorderRadius.circular(20), child: ElevatedButton( style: ElevatedButton.styleFrom( primary: const Color(0xff27AE60), ), onPressed: () { setState(() { widget.messages.add(_controller.text); }); }, child: const Icon( Icons.send, color: Colors.white, size: 18, ), ), ), ], ), ), ); } }
0
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib/main.dart
// ignore_for_file: unnecessary_const import 'package:agriday/chat.dart'; import 'package:agriday/widgets/databox.dart'; import 'package:flutter/material.dart'; import 'widgets/hscroll.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @override State<MyApp> createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { // This widget is the root of your application. @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( routes: { '/chat': (context) => Chat("", "", "", 0, 0, 0, 0, ""), }, debugShowCheckedModeBanner: false, title: 'Flutter Demo', home: const HomePage(), ); } } class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override State<HomePage> createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { int sortindex = 0; String s = ""; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.grey[300], appBar: AppBar( title: const Align( alignment: Alignment.centerLeft, child: const Text( "Buy", style: const TextStyle( color: Colors.black, fontSize: 30, fontWeight: FontWeight.bold), ), ), elevation: 0, backgroundColor: Colors.grey[300], ), body: SingleChildScrollView( child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ SizedBox( height: 50, width: 250, child: TextField( onChanged: (value) { s = value; setState(() { databox(sortindex, value); }); }, style: const TextStyle( color: Colors.blue, ), decoration: const InputDecoration( prefixIcon: Icon(Icons.search), hintText: "Search", fillColor: Colors.white, filled: true, hintStyle: TextStyle(color: Colors.grey, fontSize: 17.0)), ), ), Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( onPressed: () { showModalBottomSheet( context: context, builder: (context) { return FractionallySizedBox( heightFactor: 0.6, child: Padding( padding: const EdgeInsets.only(top: 30.0), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ const Text("Name", style: const TextStyle( fontSize: 20, fontWeight: FontWeight.bold)), Column( children: [ IconButton( onPressed: () { setState(() { sortindex = 1; Navigator.pop(context); }); }, icon: Icon( Icons.arrow_upward, color: sortindex != 1 ? Colors.black : const Color(0xff219653), ), ), Text("A -> Z", style: TextStyle( fontSize: 10, color: sortindex != 1 ? Colors.black : const Color( 0xff219653))) ], ), Column( children: [ IconButton( onPressed: () { setState(() { sortindex = 2; Navigator.pop(context); }); }, icon: Icon( Icons.arrow_downward, color: sortindex != 2 ? Colors.black : const Color(0xff219653), ), ), Text("Z -> A", style: TextStyle( fontSize: 10, color: sortindex != 2 ? Colors.black : const Color( 0xff219653))) ], ), ], ), const Divider( color: Colors.grey, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ const Text("Price", style: const TextStyle( fontSize: 20, fontWeight: FontWeight.bold)), Column( children: [ IconButton( onPressed: () { setState(() { sortindex = 3; Navigator.pop(context); }); }, icon: Icon( Icons.arrow_upward, color: sortindex != 3 ? Colors.black : const Color(0xff219653), ), ), Text("1 -> 9", style: TextStyle( fontSize: 10, color: sortindex != 3 ? Colors.black : const Color( 0xff219653))) ], ), Column( children: [ IconButton( onPressed: () { setState(() { sortindex = 4; Navigator.pop(context); }); }, icon: Icon( Icons.arrow_downward, color: sortindex != 4 ? Colors.black : const Color(0xff219653), ), ), Text("9 -> 1", style: TextStyle( fontSize: 10, color: sortindex != 4 ? Colors.black : const Color( 0xff219653))) ], ), ], ) ], ), ), ); }); }, icon: const Icon( Icons.sort, ), tooltip: "Sort", ), const Text( "Sort", style: const TextStyle(fontSize: 10), ) ], ) ], ), SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: const [ hscroll( "https://media.istockphoto.com/photos/red-apple-with-leaf-isolated-on-white-background-picture-id185262648?b=1&k=20&m=185262648&s=170667a&w=0&h=2ouM2rkF5oBplBmZdqs3hSOdBzA4mcGNCoF2P0KUMTM=", "Apple"), hscroll( "https://media.istockphoto.com/photos/green-grape-isolated-on-white-background-picture-id489520104?k=20&m=489520104&s=612x612&w=0&h=n1_B8jn9fb4dQibPhkXftNpjKA4Rvrjp_ttgj6sq5jY=", "Grapes"), hscroll( "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTcU_mjwe_m8JGxeZEB-_XZQ5dEToGI2fHkXQ&usqp=CAU", "Lemons"), hscroll( "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQe5TtaDf-UR7zfSg9HS9dy0LoECHSaUfxlnA&usqp=CAU", "Watermelon"), hscroll( "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQKfFxG40IBSC5tufNvvFSewTs6ksVEagDbAw&usqp=CAU", "Mango") ], ), ), databox(sortindex, s) ], ), ), ); } }
0
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib/widgets/messageout.dart
import 'package:flutter/material.dart'; class MessageOut extends StatefulWidget { MessageOut( this.s, { Key? key, }) : super(key: key); String s = ""; @override State<MessageOut> createState() => _MessageOutState(); } class _MessageOutState extends State<MessageOut> { @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(2.0), child: Align( alignment: Alignment.centerRight, child: Container( child: Padding( padding: const EdgeInsets.all(8.0), child: Text( widget.s, style: const TextStyle(fontSize: 15, color: Colors.white), ), ), decoration: BoxDecoration( color: const Color(0xff27AE60), borderRadius: const BorderRadius.only( topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: const Radius.circular(10)), border: Border.all(color: Colors.transparent), ), ), ), ); } }
0
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib/widgets/hscroll.dart
import 'package:flutter/material.dart'; class hscroll extends StatefulWidget { const hscroll( this.url, this.name, { Key? key, }) : super(key: key); final String url; final String name; @override State<hscroll> createState() => _hscrollState(); } class _hscrollState extends State<hscroll> { @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Container( height: 75, width: 75, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.cover, image: NetworkImage(widget.url)), color: Color(0xFFF4F4DD), border: Border.all(color: Colors.white), borderRadius: BorderRadius.all(Radius.circular(10)), ), ), Text(widget.name) ], ), ); } }
0
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib/widgets/messagein.dart
import 'package:flutter/material.dart'; class MessageIn extends StatefulWidget { MessageIn( this.s, { Key? key, }) : super(key: key); String s = ""; @override State<MessageIn> createState() => _MessageInState(); } class _MessageInState extends State<MessageIn> { @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(2.0), child: Align( alignment: Alignment.centerLeft, child: Container( child: Padding( padding: const EdgeInsets.all(8.0), child: Text( widget.s, style: const TextStyle(fontSize: 15, color: Colors.black), ), ), decoration: BoxDecoration( color: Colors.white, borderRadius: const BorderRadius.only( topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomRight: Radius.circular(10)), border: Border.all(color: Colors.white), ), ), ), ); } }
0
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/lib/widgets/databox.dart
import 'package:agriday/chat.dart'; import 'package:agriday/datamodel.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart' as rootBundle; import 'dart:convert'; class databox extends StatefulWidget { databox( this.sort, this.keyword, { Key? key, }) : super(key: key); int sort = 2; String keyword = "hi"; @override State<databox> createState() => _databoxState(); } class _databoxState extends State<databox> { @override Widget build(BuildContext context) { return FutureBuilder( future: _functiondecider(widget.sort), builder: (context, data) { if (data.hasError) { return Center( child: Text("${data.error}"), ); } else if (data.hasData) { List<Fruit> items = data.data as List<Fruit>; List<Fruit> tmpList = <Fruit>[]; for (var element in items) { if (element.product! .toLowerCase() .contains(widget.keyword.toLowerCase()) || element.price! .toString() .contains(widget.keyword.toString())) { tmpList.add(element); } if (tmpList.isNotEmpty) { items = tmpList; } else { items = []; } } return items.isNotEmpty ? ListView.builder( reverse: widget.sort == 2 || widget.sort == 4 ? true : false, physics: const NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: items.length, itemBuilder: (context, index) { return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => Chat( items[index].seller, items[index].product, items[index].variety, items[index].price, items[index].avgweight, items[index].perbox, items[index].boxes, items[index].delivery))); }, child: Padding( padding: const EdgeInsets.all(8.0), child: ClipRRect( borderRadius: BorderRadius.circular(10), child: SizedBox( height: 180, child: Column( children: [ Expanded( flex: 2, child: Container( color: Colors.white, child: Align( alignment: Alignment.centerLeft, child: Padding( padding: const EdgeInsets.all(8.0), child: Text( items[index].seller.toString(), style: const TextStyle( fontSize: 15), ), )), ), ), Expanded( flex: 5, child: Container( child: Align( alignment: Alignment.centerLeft, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( mainAxisAlignment: MainAxisAlignment .spaceEvenly, children: [ Column( children: [ Text( items[index] .product .toString(), style: const TextStyle( fontWeight: FontWeight .bold, fontSize: 20), ), const Text( "Product", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), Column( children: [ Text( items[index] .avgweight .toString(), style: const TextStyle( fontWeight: FontWeight .bold, fontSize: 20), ), const Text( "avg weight", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), ], ), Column( mainAxisAlignment: MainAxisAlignment .spaceEvenly, children: [ Column( children: [ Text( items[index] .variety .toString(), style: const TextStyle( fontWeight: FontWeight .bold, fontSize: 20), ), const Text( "Variety", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), Column( children: [ Text( items[index] .perbox .toString() + "kg", style: const TextStyle( fontWeight: FontWeight .bold, fontSize: 20), ), const Text( "per Box", style: TextStyle( color: Colors.grey, fontSize: 10), ) ], ), ], ), Column( mainAxisAlignment: MainAxisAlignment .spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ ClipRRect( borderRadius: BorderRadius.circular( 20), child: Container( height: 30, width: 100, color: const Color( // ignore: use_full_hex_values_for_flutter_colors 0xff21212114), child: Align( alignment: Alignment.center, child: Text( "₹" + items[index] .price .toString(), style: const TextStyle( color: Color( 0xff27AE60), fontSize: 20), ), ), ), ), Row( mainAxisAlignment: MainAxisAlignment .spaceBetween, children: [ Column( children: [ Text( items[index] .boxes .toString(), style: const TextStyle( fontWeight: FontWeight .bold, fontSize: 20), ), const Text( "Boxes", style: TextStyle( color: Colors .grey, fontSize: 10), ) ], ), const SizedBox( width: 25, ), Column( children: [ Text( items[index] .boxes .toString(), style: const TextStyle( fontWeight: FontWeight .bold, fontSize: 20), ), const Text( "Delivery", style: TextStyle( color: Colors .grey, fontSize: 10), ) ], ), ], ), ], ), ], )), color: const Color(0xFFF4F4DD), ), ), ], ), ), )), ); }) : Column( children: const [ SizedBox( height: 30, ), Text( "No Search Results!", style: TextStyle(color: Colors.red, fontSize: 20), ), ], ); } else { return const Center(child: CircularProgressIndicator()); } }); } Future<List<Fruit>> readJson() async { final jsondata = await rootBundle.rootBundle.loadString('lib/Fruits.json'); final list = json.decode(jsondata) as List<dynamic>; return list.map((e) => Fruit.fromJson(e)).toList(); } Future<List<Fruit>> ascendingProduct() async { try { final jsondata = await rootBundle.rootBundle.loadString('lib/Fruits.json'); final list = json.decode(jsondata) as List<dynamic>; List<Fruit> ascendinglist = list.map((d) => Fruit.fromJson(d)).toList(); ascendinglist.sort((a, b) { return a.product!.toLowerCase().compareTo(b.product!.toLowerCase()); }); return ascendinglist; } catch (e) { print(e.toString()); return []; } } Future<List<Fruit>> ascendingPrice() async { try { final jsondata = await rootBundle.rootBundle.loadString('lib/Fruits.json'); final list = json.decode(jsondata) as List<dynamic>; List<Fruit> ascendinglist = list.map((d) => Fruit.fromJson(d)).toList(); ascendinglist.sort((a, b) { return a.price!.compareTo(b.price!); }); return ascendinglist; } catch (e) { print(e.toString()); return []; } } Future<List<Fruit>> _functiondecider(int x) { switch (x) { case 0: return readJson(); case 1: return ascendingProduct(); case 2: return ascendingProduct(); case 3: return ascendingPrice(); case 4: return ascendingPrice(); } throw (Error e) { print(e); }; } }
0
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday
mirrored_repositories/Grocery-UI-with-SearchingSorting-Algo/agriday/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:agriday/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/foodie
mirrored_repositories/foodie/lib/main.dart
import 'package:flutter/material.dart'; import 'src/app.dart'; import 'src/settings/settings_controller.dart'; import 'src/settings/settings_service.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); // Set up the SettingsController, which will glue user settings to multiple // Flutter Widgets. final settingsController = SettingsController(SettingsService()); // Load the user's preferred theme while the splash screen is displayed. // This prevents a sudden theme change when the app is first displayed. await settingsController.loadSettings(); // Run the app and pass in the SettingsController. The app listens to the // SettingsController for changes, then passes it further down to the // SettingsView. runApp(MyApp(settingsController: settingsController)); }
0
mirrored_repositories/foodie/lib
mirrored_repositories/foodie/lib/src/app.dart
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:provider/provider.dart'; import 'app_theme.dart'; import 'home.dart'; import 'models/grocery_item.dart'; import 'screens/grocery_item_screen.dart'; import 'settings/settings_controller.dart'; import 'settings/settings_view.dart'; import 'utils/grocery_manager.dart'; import 'utils/tab_manager.dart'; /// The Widget that configures your application. class MyApp extends StatelessWidget { const MyApp({ super.key, required this.settingsController, }); final SettingsController settingsController; @override Widget build(BuildContext context) { // Glue the SettingsController to the MaterialApp. // // The AnimatedBuilder Widget listens to the SettingsController for changes. // Whenever the user updates their settings, the MaterialApp is rebuilt. return AnimatedBuilder( animation: settingsController, builder: (BuildContext context, Widget? child) { return MultiProvider( providers: [ ChangeNotifierProvider( create: (context) => TabManager(), ), ChangeNotifierProvider( create: (context) => GroceryManager(), ), ], child: MaterialApp( // Providing a restorationScopeId allows the Navigator built by the // MaterialApp to restore the navigation stack when a user leaves // and returns to the app after it has been killed while running // in the background. restorationScopeId: 'app', // Provide the generated AppLocalizations to the MaterialApp. This // allows descendant Widgets to display the correct translations // depending on the user's locale. localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: const [ Locale('en', ''), // English, no country code ], // Use AppLocalizations to configure the correct application title // depending on the user's locale. // // The appTitle is defined in .arb files found in the localization // directory. onGenerateTitle: (BuildContext context) => AppLocalizations.of(context)!.appTitle, // Define a light and dark color theme. Then, read the user's // preferred ThemeMode (light, dark, or system default) from the // SettingsController to display the correct theme. theme: AppTheme.light(), darkTheme: AppTheme.dark(), themeMode: settingsController.themeMode, // Define a function to handle named routes in order to support // Flutter web url navigation and deep linking. onGenerateRoute: (RouteSettings routeSettings) { return MaterialPageRoute<void>( settings: routeSettings, builder: (BuildContext context) { switch (routeSettings.name) { case SettingsView.routeName: return SettingsView(controller: settingsController); case GroceryItemScreen.routeName: final manager = Provider.of<GroceryManager>(context, listen: false); GroceryItem? item; if (routeSettings.arguments != null) { final json = routeSettings.arguments as Map<String, dynamic>; item = GroceryItem.fromJson(json); } return GroceryItemScreen( originalItem: item, onCreate: (item) { manager.addItem(item); Navigator.pop(context); }, onUpdate: (item) { manager.updateItem(item, item.index ?? 0); Navigator.pop(context); }, ); default: return const Home(); } }, ); }, ), ); }, ); } }
0
mirrored_repositories/foodie/lib
mirrored_repositories/foodie/lib/src/app_theme.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; class AppTheme { static const themePrefKey = 'theme'; static TextTheme lightTextTheme = TextTheme( bodyLarge: GoogleFonts.openSans( fontSize: 14.0, fontWeight: FontWeight.w700, color: Colors.black, ), displayLarge: GoogleFonts.openSans( fontSize: 32.0, fontWeight: FontWeight.bold, color: Colors.black, ), displayMedium: GoogleFonts.openSans( fontSize: 21.0, fontWeight: FontWeight.w700, color: Colors.black, ), displaySmall: GoogleFonts.openSans( fontSize: 16.0, fontWeight: FontWeight.w600, color: Colors.black, ), titleLarge: GoogleFonts.openSans( fontSize: 20.0, fontWeight: FontWeight.w600, color: Colors.black, ), titleMedium: GoogleFonts.openSans( fontSize: 18.0, fontWeight: FontWeight.w600, color: Colors.black, ), ); static TextTheme darkTextTheme = TextTheme( bodyLarge: GoogleFonts.openSans( fontSize: 14.0, fontWeight: FontWeight.w700, color: Colors.white, ), displayLarge: GoogleFonts.openSans( fontSize: 32.0, fontWeight: FontWeight.bold, color: Colors.white, ), displayMedium: GoogleFonts.openSans( fontSize: 21.0, fontWeight: FontWeight.w700, color: Colors.white, ), displaySmall: GoogleFonts.openSans( fontSize: 16.0, fontWeight: FontWeight.w600, color: Colors.white, ), titleLarge: GoogleFonts.openSans( fontSize: 20.0, fontWeight: FontWeight.w600, color: Colors.white, ), titleMedium: GoogleFonts.openSans( fontSize: 18.0, fontWeight: FontWeight.w600, color: Colors.white, ), ); static ThemeData light() { return ThemeData( brightness: Brightness.light, checkboxTheme: CheckboxThemeData( fillColor: MaterialStateColor.resolveWith( (states) { return Colors.black; }, ), ), appBarTheme: const AppBarTheme( foregroundColor: Colors.black, backgroundColor: Colors.white, ), floatingActionButtonTheme: const FloatingActionButtonThemeData( foregroundColor: Colors.white, backgroundColor: Colors.black, ), bottomNavigationBarTheme: const BottomNavigationBarThemeData( selectedItemColor: Colors.green, ), textTheme: lightTextTheme, ); } static ThemeData dark() { return ThemeData( brightness: Brightness.dark, appBarTheme: AppBarTheme( foregroundColor: Colors.white, backgroundColor: Colors.grey[900], ), floatingActionButtonTheme: const FloatingActionButtonThemeData( foregroundColor: Colors.white, backgroundColor: Colors.green, ), bottomNavigationBarTheme: const BottomNavigationBarThemeData( selectedItemColor: Colors.green, ), textTheme: darkTextTheme, ); } }
0
mirrored_repositories/foodie/lib
mirrored_repositories/foodie/lib/src/home.dart
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; import 'screens/explore_screen.dart'; import 'screens/grocery_screen.dart'; import 'screens/recipes_screen.dart'; import 'settings/settings_view.dart'; import 'utils/set_page_title.dart'; import 'utils/tab_manager.dart'; class Home extends StatefulWidget { const Home({super.key}); @override State<Home> createState() => _HomeScreenState(); } class _HomeScreenState extends State<Home> { static List<Widget> pages = <Widget>[ const ExploreScreen(), RecipesScreen(), const GroceryScreen(), ]; @override Widget build(BuildContext context) { return Consumer<TabManager>( builder: (context, tabManager, child) { return Scaffold( appBar: AppBar( title: Text( 'Foodie', style: Theme.of(context).textTheme.titleLarge, ), actions: [ IconButton( icon: const Icon(Icons.settings), onPressed: () { // Navigate to the settings page. If the user leaves and // returns to the app after it has been killed while running // in the background, the navigation stack is restored. Navigator.restorablePushNamed( context, SettingsView.routeName, ); }, ), ], ), body: IndexedStack(index: tabManager.selectedTab, children: pages), bottomNavigationBar: BottomNavigationBar( selectedItemColor: Theme.of(context).textSelectionTheme.selectionColor, currentIndex: tabManager.selectedTab, onTap: (index) { tabManager.goToTab(index); if (index == 1) { setPageTitle(AppLocalizations.of(context)!.recipes, context); } else if (index == 2) { setPageTitle(AppLocalizations.of(context)!.toBuy, context); } else { setPageTitle('', context); } }, items: [ BottomNavigationBarItem( icon: const Icon(Icons.explore), label: AppLocalizations.of(context)!.explore, ), BottomNavigationBarItem( icon: const Icon(Icons.book), label: AppLocalizations.of(context)!.recipes, ), BottomNavigationBarItem( icon: const Icon(Icons.list), label: AppLocalizations.of(context)!.toBuy, ), ], ), ); }, ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/circle_image.dart
import 'package:flutter/material.dart'; class CircleImage extends StatelessWidget { const CircleImage({ super.key, this.imageRadius = 20, this.imageProvider, }); final double imageRadius; final ImageProvider? imageProvider; @override Widget build(BuildContext context) { return CircleAvatar( backgroundColor: Colors.white, radius: imageRadius, child: CircleAvatar( radius: imageRadius - 5, backgroundImage: imageProvider, ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/friend_post_list_view.dart
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../models/post.dart'; import 'friend_post_tile.dart'; class FriendPostListView extends StatelessWidget { const FriendPostListView({ super.key, required this.friendPosts, }); final List<Post> friendPosts; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only( left: 16, top: 0, right: 16, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( '${AppLocalizations.of(context)!.socialChefs} 👩‍🍳', style: Theme.of(context).textTheme.displayLarge, ), const SizedBox(height: 16), ListView.separated( // Since you're nesting two list views, it's a good idea to set // primary to false. That lets Flutter know that this isn't the // primary scroll view. primary: false, // Even though you set primary to false, it's also a good idea to // disable the scrolling for this list view. That will propagate // up to the parent list view. physics: const NeverScrollableScrollPhysics(), // Set shrinkWrap to true to create a fixed-length scrollable list // of items. This gives it a fixed height. If this was false, // you'd get an unbounded height error. shrinkWrap: true, scrollDirection: Axis.vertical, itemBuilder: (context, index) { final post = friendPosts[index]; return FriendPostTile(post: post); }, separatorBuilder: (context, index) { return const SizedBox(height: 16); }, itemCount: friendPosts.length, ), const SizedBox(height: 16), ], ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/recipes_grid_view.dart
import 'package:flutter/material.dart'; import '../models/simple_recipe.dart'; import 'recipe_thumbnail.dart'; class RecipesGridView extends StatelessWidget { const RecipesGridView({ super.key, required this.recipes, }); final List<SimpleRecipe> recipes; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only( left: 16, top: 16, right: 16, ), child: GridView.builder( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, ), itemBuilder: (context, index) { final recipe = recipes[index]; return RecipeThumbnail(recipe: recipe); }, itemCount: recipes.length, ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/friend_post_tile.dart
import 'package:flutter/material.dart'; import '../models/post.dart'; import 'circle_image.dart'; class FriendPostTile extends StatelessWidget { const FriendPostTile({ super.key, required this.post, }); final Post post; @override Widget build(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ CircleImage(imageProvider: AssetImage(post.profileImageUrl)), const SizedBox(width: 16), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(post.comment), Text( '${post.timestamp} mins ago', style: const TextStyle(fontWeight: FontWeight.w700), ), ], ), ) ], ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/card3.dart
import 'package:flutter/material.dart'; import '../app_theme.dart'; import '../models/explore_recipe.dart'; class Card3 extends StatelessWidget { const Card3({ super.key, required this.recipe, }); final ExploreRecipe recipe; List<Widget> createTagChips() { final chips = <Widget>[]; recipe.tags.take(6).forEach((element) { final chip = Chip( label: Text( element, style: AppTheme.darkTextTheme.bodyLarge, ), backgroundColor: Colors.black.withOpacity(0.7), ); chips.add(chip); }); return chips; } @override Widget build(BuildContext context) { return Center( child: Container( constraints: const BoxConstraints.expand( width: 350, height: 450, ), decoration: BoxDecoration( image: DecorationImage( image: AssetImage(recipe.backgroundImage), fit: BoxFit.cover, ), borderRadius: const BorderRadius.all(Radius.circular(10.0)), ), child: Stack( children: [ Container( decoration: BoxDecoration( color: Colors.black.withOpacity(0.6), borderRadius: const BorderRadius.all(Radius.circular(10.0)), ), ), Container( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Icon( Icons.book, color: Colors.white, size: 40, ), const SizedBox(height: 8), Text( recipe.title, style: AppTheme.darkTextTheme.displayMedium, ), const SizedBox(height: 30), ], ), ), Center( child: Wrap( alignment: WrapAlignment.start, spacing: 12, runSpacing: 12, children: createTagChips(), ), ), ], ), ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/widgets.dart
export 'author_card.dart'; export 'card1.dart'; export 'card2.dart'; export 'card3.dart'; export 'circle_image.dart'; export 'friend_post_list_view.dart'; export 'today_recipe_list_view.dart';
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/card1.dart
import 'package:flutter/material.dart'; import '../app_theme.dart'; import '../models/explore_recipe.dart'; class Card1 extends StatelessWidget { const Card1({ super.key, required this.recipe, }); final ExploreRecipe recipe; @override Widget build(BuildContext context) { return Center( child: Container( padding: const EdgeInsets.all(16), constraints: const BoxConstraints.expand( width: 350, height: 450, ), decoration: BoxDecoration( image: DecorationImage( image: AssetImage(recipe.backgroundImage), fit: BoxFit.cover, ), borderRadius: const BorderRadius.all(Radius.circular(10.0)), ), child: Stack( children: [ Text( recipe.subtitle, style: AppTheme.darkTextTheme.bodyLarge, ), Positioned( top: 20, child: Text( recipe.title, style: AppTheme.darkTextTheme.displayMedium, ), ), Positioned( bottom: 30, right: 0, child: Text( recipe.message, style: AppTheme.darkTextTheme.bodyLarge, ), ), Positioned( bottom: 10, right: 0, child: Text( recipe.authorName, style: AppTheme.darkTextTheme.bodyLarge, ), ), ], ), ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/author_card.dart
import 'package:flutter/material.dart'; import '../app_theme.dart'; import 'circle_image.dart'; class AuthorCard extends StatefulWidget { const AuthorCard({ super.key, required this.authorName, required this.title, this.imageProvider, }); final String authorName; final String title; final ImageProvider? imageProvider; @override State<AuthorCard> createState() => _AuthorCardState(); } class _AuthorCardState extends State<AuthorCard> { bool _isFavorited = false; @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.all(16), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ CircleImage( imageRadius: 28, imageProvider: widget.imageProvider, ), const SizedBox(width: 8), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( widget.authorName, style: AppTheme.lightTextTheme.displayMedium, ), Text( widget.title, style: AppTheme.lightTextTheme.displaySmall, ), ], ), ], ), IconButton( onPressed: () { setState(() => _isFavorited = !_isFavorited); }, icon: Icon(_isFavorited ? Icons.favorite : Icons.favorite_border), iconSize: 30, color: Colors.red[400], ), ], ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/recipe_thumbnail.dart
import 'package:flutter/material.dart'; import '../models/simple_recipe.dart'; class RecipeThumbnail extends StatelessWidget { const RecipeThumbnail({ super.key, required this.recipe, }); final SimpleRecipe recipe; @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.all(8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: ClipRRect( borderRadius: BorderRadius.circular(12), child: Image.asset( recipe.dishImage, fit: BoxFit.cover, ), ), ), const SizedBox(height: 10), Text( recipe.title, maxLines: 1, style: Theme.of(context).textTheme.bodyLarge, ), Text( recipe.duration, style: Theme.of(context).textTheme.bodyLarge, ), ], ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/card2.dart
import 'package:flutter/material.dart'; import '../app_theme.dart'; import '../models/explore_recipe.dart'; import 'author_card.dart'; class Card2 extends StatelessWidget { const Card2({ super.key, required this.recipe, }); final ExploreRecipe recipe; @override Widget build(BuildContext context) { return Center( child: Container( constraints: const BoxConstraints.expand( width: 350, height: 450, ), decoration: BoxDecoration( image: DecorationImage( image: AssetImage(recipe.backgroundImage), fit: BoxFit.cover, ), borderRadius: const BorderRadius.all(Radius.circular(10.0)), ), child: Column( children: [ AuthorCard( authorName: recipe.authorName, title: recipe.role, imageProvider: AssetImage(recipe.profileImage), ), Expanded( child: Stack( children: [ Positioned( bottom: 16, right: 16, child: Text( recipe.title, style: AppTheme.lightTextTheme.displayLarge, ), ), Positioned( bottom: 70, left: 16, child: RotatedBox( quarterTurns: 3, child: Text( recipe.subtitle, style: AppTheme.lightTextTheme.displayLarge, ), ), ), ], ), ), ], ), ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/today_recipe_list_view.dart
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../models/explore_recipe.dart'; import 'widgets.dart'; class TodayRecipeListView extends StatelessWidget { const TodayRecipeListView({ super.key, required this.recipes, }); final List<ExploreRecipe> recipes; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only( left: 16, top: 16, right: 16, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( '${AppLocalizations.of(context)!.recipesOfTheDay} 🍳', style: Theme.of(context).textTheme.displayLarge, ), const SizedBox(height: 16), Container( height: 400, color: Colors.transparent, child: ListView.separated( scrollDirection: Axis.horizontal, itemBuilder: (context, index) { final recipe = recipes[index]; return buildCard(recipe); }, separatorBuilder: (context, index) { return const SizedBox(width: 16); }, itemCount: recipes.length, ), ), ], ), ); } Widget buildCard(ExploreRecipe recipe) { if (recipe.cardType == RecipeCardType.card1) { return Card1(recipe: recipe); } else if (recipe.cardType == RecipeCardType.card2) { return Card2(recipe: recipe); } else if (recipe.cardType == RecipeCardType.card3) { return Card3(recipe: recipe); } else { throw Exception("This card doesn't exist yet"); } } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/widgets/grocery_tile.dart
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; import '../models/grocery_item.dart'; class GroceryTile extends StatelessWidget { GroceryTile({ super.key, required this.item, this.onComplete, }) : textDecoration = item.isComplete ? TextDecoration.lineThrough : TextDecoration.none; final GroceryItem item; final Function(bool?)? onComplete; final TextDecoration textDecoration; @override Widget build(BuildContext context) { return SizedBox( height: 100.0, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Container(width: 5.0, color: item.color), const SizedBox(width: 16), Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( item.name, style: GoogleFonts.lato( fontSize: 21.0, fontWeight: FontWeight.bold, decoration: textDecoration, ), ), const SizedBox(height: 4), buildDate(), const SizedBox(height: 4), buildImportance(context), ], ), ], ), Row( children: [ Text( item.quantity.toString(), style: GoogleFonts.lato( fontSize: 21.0, decoration: textDecoration, ), ), buildCheckbox(), ], ), ], ), ); } Widget buildImportance(BuildContext context) { if (item.importance == Importance.low) { return Text( AppLocalizations.of(context)!.low, style: GoogleFonts.lato(decoration: textDecoration), ); } else if (item.importance == Importance.medium) { return Text( AppLocalizations.of(context)!.medium, style: GoogleFonts.lato( fontWeight: FontWeight.w800, decoration: textDecoration, ), ); } else if (item.importance == Importance.high) { return Text( AppLocalizations.of(context)!.high, style: GoogleFonts.lato( color: Colors.red, fontWeight: FontWeight.w900, decoration: textDecoration, ), ); } else { throw Exception('This importance type does not exist'); } } Widget buildDate() { final dateFormatter = DateFormat('MMMM dd h:mm a'); final dateString = dateFormatter.format(item.date); return Text( dateString, style: TextStyle(decoration: textDecoration), ); } Widget buildCheckbox() { return Checkbox( value: item.isComplete, onChanged: onComplete, ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/models/explore_data.dart
import 'models.dart'; class ExploreData { final List<ExploreRecipe> todayRecipes; final List<Post> friendPosts; ExploreData( this.todayRecipes, this.friendPosts, ); }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/models/grocery_item.dart
import 'package:flutter/painting.dart'; enum Importance { low, medium, high, } class GroceryItem { final String id; final String name; final Importance importance; final Color color; final int quantity; final DateTime date; final bool isComplete; int? index; GroceryItem({ required this.id, required this.name, required this.importance, required this.color, required this.quantity, required this.date, this.isComplete = false, this.index, }); /// Copies and creates a completely new instance of [GroceryItem]. GroceryItem copyWith({ String? id, String? name, Importance? importance, Color? color, int? quantity, DateTime? date, bool? isComplete, int? index, }) { return GroceryItem( id: id ?? this.id, name: name ?? this.name, importance: importance ?? this.importance, color: color ?? this.color, quantity: quantity ?? this.quantity, date: date ?? this.date, isComplete: isComplete ?? this.isComplete, index: index ?? this.index, ); } factory GroceryItem.fromJson(Map<String, dynamic> json) { return GroceryItem( id: json['id'], name: json['name'], importance: Importance.values.byName(json['importance']), color: Color(int.parse(json['color'])), quantity: int.parse(json['quantity']), date: DateTime.parse(json['date']), isComplete: bool.parse(json['isComplete']), index: int.parse(json['index'] ?? '0'), ); } Map<String, dynamic> toJson() { return { 'id': id, 'name': name, 'importance': importance.name, 'color': color.value.toString(), 'quantity': quantity.toString(), 'date': date.toString(), 'isComplete': isComplete.toString(), 'index': index.toString(), }; } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/models/instruction.dart
part of 'explore_recipe.dart'; class Instruction { String imageUrl; String description; int durationInMinutes; Instruction({ required this.imageUrl, required this.description, required this.durationInMinutes, }); factory Instruction.fromJson(Map<String, dynamic> json) { return Instruction( imageUrl: json['imageUrl'] ?? '', description: json['description'] ?? '', durationInMinutes: json['durationInMinutes'] ?? '', ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/models/ingredient.dart
part of 'explore_recipe.dart'; class Ingredient { String imageUrl; String title; String source; Ingredient({ required this.imageUrl, required this.title, required this.source, }); factory Ingredient.fromJson(Map<String, dynamic> json) { return Ingredient( imageUrl: json['imageUrl'] ?? '', title: json['title'] ?? '', source: json['source'] ?? '', ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/models/explore_recipe.dart
part 'ingredient.dart'; part 'instruction.dart'; class RecipeCardType { static const card1 = 'card1'; static const card2 = 'card2'; static const card3 = 'card3'; } class ExploreRecipe { String id; String cardType; String title; String subtitle; String backgroundImage; String backgroundImageSource; String message; String authorName; String role; String profileImage; int durationInMinutes; String dietType; int calories; List<String> tags; String description; String source; List<Ingredient> ingredients; List<Instruction> instructions; ExploreRecipe({ required this.id, required this.cardType, required this.title, this.subtitle = '', this.backgroundImage = '', this.backgroundImageSource = '', this.message = '', this.authorName = '', this.role = '', this.profileImage = '', this.durationInMinutes = 0, this.dietType = '', this.calories = 0, this.tags = const [], this.description = '', this.source = '', this.ingredients = const [], this.instructions = const [], }); factory ExploreRecipe.fromJson(Map<String, dynamic> json) { final ingredients = <Ingredient>[]; final instructions = <Instruction>[]; if (json['ingredients'] != null) { json['ingredients'].forEach((v) { ingredients.add(Ingredient.fromJson(v)); }); } if (json['instructions'] != null) { json['instructions'].forEach((v) { instructions.add(Instruction.fromJson(v)); }); } return ExploreRecipe( id: json['id'] ?? '', cardType: json['cardType'] ?? '', title: json['title'] ?? '', subtitle: json['subtitle'] ?? '', backgroundImage: json['backgroundImage'] ?? '', backgroundImageSource: json['backgroundImageSource'] ?? '', message: json['message'] ?? '', authorName: json['authorName'] ?? '', role: json['role'] ?? '', profileImage: json['profileImage'] ?? '', durationInMinutes: json['durationInMinutes'] ?? 0, dietType: json['dietType'] ?? '', calories: json['calories'] ?? 0, tags: json['tags'].cast<String>() ?? [], description: json['description'] ?? '', source: json['source'] ?? '', ingredients: ingredients, instructions: instructions, ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/models/models.dart
export 'explore_data.dart'; export 'explore_recipe.dart'; export 'post.dart'; export 'simple_recipe.dart';
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/models/simple_recipe.dart
class SimpleRecipe { String id; String dishImage; String title; String duration; String source; List<String> information; SimpleRecipe({ required this.id, required this.dishImage, required this.title, required this.duration, required this.source, required this.information, }); factory SimpleRecipe.fromJson(Map<String, dynamic> json) { return SimpleRecipe( id: json['id'] as String, dishImage: json['dishImage'] as String, title: json['title'] as String, duration: json['duration'] as String, source: json['source'] as String, information: json['information'].cast<String>() as List<String>, ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/models/post.dart
class Post { String id; String profileImageUrl; String comment; String foodPictureUrl; String timestamp; Post({ required this.id, required this.profileImageUrl, required this.comment, required this.foodPictureUrl, required this.timestamp, }); factory Post.fromJson(Map<String, dynamic> json) { return Post( id: json['id'] ?? '', profileImageUrl: json['profileImageUrl'] ?? '', comment: json['comment'] ?? '', foodPictureUrl: json['foodPictureUrl'] ?? '', timestamp: json['timestamp'] ?? '', ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/api/mock_foodie_service.dart
import 'dart:convert'; import 'package:flutter/services.dart'; import '../models/models.dart'; /// Mock recipe service that grabs sample json data to mock recipe request/response class MockFoodieService { /// Batch request that gets both today recipes and friend's feed Future<ExploreData> getExploreData() async { final todayRecipes = await _getTodayRecipes(); final friendPosts = await _getFriendFeed(); return ExploreData(todayRecipes, friendPosts); } /// Get sample explore recipes json to display in ui Future<List<ExploreRecipe>> _getTodayRecipes() async { // Simulate api request wait time await Future.delayed(const Duration(milliseconds: 1000)); // Load json from file system final dataString = await _loadAsset('assets/sample_data/sample_explore_recipes.json'); // Decode to json final Map<String, dynamic> json = jsonDecode(dataString); // Go through each recipe and convert json to ExploreRecipe object. if (json['recipes'] != null) { final recipes = <ExploreRecipe>[]; json['recipes'].forEach((v) { recipes.add(ExploreRecipe.fromJson(v)); }); return recipes; } else { return []; } } /// Get the sample friend json posts to display in ui Future<List<Post>> _getFriendFeed() async { // Simulate api request wait time await Future.delayed(const Duration(milliseconds: 1000)); // Load json from file system final dataString = await _loadAsset('assets/sample_data/sample_friends_feed.json'); // Decode to json final Map<String, dynamic> json = jsonDecode(dataString); // Go through each post and convert json to Post object. if (json['feed'] != null) { final posts = <Post>[]; json['feed'].forEach((v) { posts.add(Post.fromJson(v)); }); return posts; } else { return []; } } /// Get the sample recipe json to display in ui Future<List<SimpleRecipe>> getRecipes() async { // Simulate api request wait time await Future.delayed(const Duration(milliseconds: 1000)); // Load json from file system final dataString = await _loadAsset('assets/sample_data/sample_recipes.json'); // Decode to json final Map<String, dynamic> json = jsonDecode(dataString); // Go through each recipe and convert json to SimpleRecipe object. if (json['recipes'] != null) { final recipes = <SimpleRecipe>[]; json['recipes'].forEach((v) { recipes.add(SimpleRecipe.fromJson(v)); }); return recipes; } else { return []; } } /// Loads sample json data from file system Future<String> _loadAsset(String path) async { return rootBundle.loadString(path); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/utils/tab_manager.dart
import 'package:flutter/material.dart'; /// Manages the tab index that the user taps. class TabManager with ChangeNotifier { /// Keeps track of which tab the user tapped. int selectedTab = 0; /// Simple function that modifies the current tab index. void goToTab(int index) { selectedTab = index; notifyListeners(); } /// Specific function that sets `selectedTab` to the Recipes tab, /// which is at index 1. void goToRecipes() { selectedTab = 1; notifyListeners(); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/utils/set_page_title.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; void setPageTitle(String title, BuildContext context) { SystemChrome.setApplicationSwitcherDescription( ApplicationSwitcherDescription( label: title != '' ? '${AppLocalizations.of(context)!.appTitle} | $title' : AppLocalizations.of(context)!.appTitle, primaryColor: Theme.of(context).primaryColor.value, ), ); }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/utils/grocery_manager.dart
import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../models/grocery_item.dart'; /// Manages the changing and updating of grocery items. class GroceryManager with ChangeNotifier { static const itemsKey = 'grocery_items'; List<GroceryItem> _groceryItems = []; List<GroceryItem> get groceryItems => List.unmodifiable(_groceryItems); GroceryManager() { initGroceryItems(); } /// Sets `_groceryItems` value if there is data from local storage. void initGroceryItems() async { final prefs = await SharedPreferences.getInstance(); final dataString = prefs.getString(itemsKey); final items = <GroceryItem>[]; if (dataString != null) { jsonDecode(dataString).asMap().forEach((i, v) { v['index'] = i.toString(); items.add(GroceryItem.fromJson(v)); }); _groceryItems = items; notifyListeners(); } } /// Adds a new grocery item at the end of the list. void addItem(GroceryItem item) { _groceryItems.add(item); setGroceryItems(); notifyListeners(); } /// Replaces the old item at a given index with a new item. void updateItem(GroceryItem item, int index) { _groceryItems[index] = item; setGroceryItems(); notifyListeners(); } /// Deletes an item at a particular index. void deleteItem(int index) { _groceryItems.removeAt(index); setGroceryItems(); notifyListeners(); } /// Toggles the `isComplete` flag on and off. void completeItem(int index, bool change) { final item = _groceryItems[index]; _groceryItems[index] = item.copyWith(isComplete: change); setGroceryItems(); notifyListeners(); } /// Persists grocery items to local storage. void setGroceryItems() async { final prefs = await SharedPreferences.getInstance(); prefs.setString(itemsKey, jsonEncode(_groceryItems)); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/settings/settings_controller.dart
import 'package:flutter/material.dart'; import 'settings_service.dart'; /// A class that many Widgets can interact with to read user settings, update /// user settings, or listen to user settings changes. /// /// Controllers glue Data Services to Flutter Widgets. The SettingsController /// uses the SettingsService to store and retrieve user settings. class SettingsController with ChangeNotifier { SettingsController(this._settingsService); // Make SettingsService a private variable so it is not used directly. final SettingsService _settingsService; // Make ThemeMode a private variable so it is not updated directly without // also persisting the changes with the SettingsService. late ThemeMode _themeMode; // Allow Widgets to read the user's preferred ThemeMode. ThemeMode get themeMode => _themeMode; /// Load the user's settings from the SettingsService. It may load from a /// local database or the internet. The controller only knows it can load the /// settings from the service. Future<void> loadSettings() async { _themeMode = await _settingsService.themeMode(); // Important! Inform listeners a change has occurred. notifyListeners(); } /// Update and persist the ThemeMode based on the user's selection. Future<void> updateThemeMode(ThemeMode? newThemeMode) async { if (newThemeMode == null) return; // Do not perform any work if new and old ThemeMode are identical if (newThemeMode == _themeMode) return; // Otherwise, store the new ThemeMode in memory _themeMode = newThemeMode; // Important! Inform listeners a change has occurred. notifyListeners(); // Persist the changes to a local database or the internet using the // SettingService. await _settingsService.updateThemeMode(newThemeMode); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/settings/settings_view.dart
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../utils/set_page_title.dart'; import 'settings_controller.dart'; /// Displays the various settings that can be customized by the user. /// /// When a user changes a setting, the SettingsController is updated and /// Widgets that listen to the SettingsController are rebuilt. class SettingsView extends StatelessWidget { const SettingsView({super.key, required this.controller}); static const routeName = '/settings'; final SettingsController controller; @override Widget build(BuildContext context) { setPageTitle(AppLocalizations.of(context)!.settings, context); return Scaffold( appBar: AppBar( title: Text(AppLocalizations.of(context)!.settings), ), body: Padding( padding: const EdgeInsets.all(16), // Glue the SettingsController to the theme selection DropdownButton. // // When a user selects a theme from the dropdown list, the // SettingsController is updated, which rebuilds the MaterialApp. child: DropdownButton<ThemeMode>( // Read the selected themeMode from the controller value: controller.themeMode, // Call the updateThemeMode method any time the user selects a theme. onChanged: controller.updateThemeMode, items: [ DropdownMenuItem( value: ThemeMode.system, child: Text(AppLocalizations.of(context)!.systemTheme), ), DropdownMenuItem( value: ThemeMode.light, child: Text(AppLocalizations.of(context)!.lightTheme), ), DropdownMenuItem( value: ThemeMode.dark, child: Text(AppLocalizations.of(context)!.darkTheme), ) ], ), ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/settings/settings_service.dart
import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../app_theme.dart'; /// A service that stores and retrieves user settings. /// /// By default, this class does not persist user settings. If you'd like to /// persist the user settings locally, use the shared_preferences package. If /// you'd like to store settings on a web server, use the http package. class SettingsService { /// Loads the User's preferred ThemeMode from local or remote storage. Future<ThemeMode> themeMode() async { final prefs = await SharedPreferences.getInstance(); final currentTheme = prefs.getString(AppTheme.themePrefKey) ?? 'system'; return switch (currentTheme) { 'light' => ThemeMode.light, 'dark' => ThemeMode.dark, _ => ThemeMode.system }; } /// Persists the user's preferred ThemeMode to local or remote storage. Future<void> updateThemeMode(ThemeMode theme) async { // Use the shared_preferences package to persist settings locally or the // http package to persist settings over the network. final prefs = await SharedPreferences.getInstance(); switch (theme) { case ThemeMode.light: await prefs.setString(AppTheme.themePrefKey, 'light'); case ThemeMode.dark: await prefs.setString(AppTheme.themePrefKey, 'dark'); default: await prefs.setString(AppTheme.themePrefKey, 'system'); } } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/screens/recipes_screen.dart
import 'package:flutter/material.dart'; import '../api/mock_foodie_service.dart'; import '../models/simple_recipe.dart'; import '../widgets/recipes_grid_view.dart'; class RecipesScreen extends StatelessWidget { RecipesScreen({super.key}); final mockService = MockFoodieService(); @override Widget build(BuildContext context) { return FutureBuilder( future: mockService.getRecipes(), builder: (context, AsyncSnapshot<List<SimpleRecipe>> snapshot) { if (snapshot.connectionState == ConnectionState.done) { return RecipesGridView(recipes: snapshot.data ?? []); } else { return const Center(child: CircularProgressIndicator()); } }, ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/screens/explore_screen.dart
import 'dart:developer'; import 'package:flutter/material.dart'; import '../api/mock_foodie_service.dart'; import '../models/explore_data.dart'; import '../widgets/widgets.dart'; class ExploreScreen extends StatefulWidget { const ExploreScreen({super.key}); @override State<ExploreScreen> createState() => _ExploreScreenState(); } class _ExploreScreenState extends State<ExploreScreen> { final mockService = MockFoodieService(); late ScrollController _scrollController; void _scrollListener() { if (_scrollController.offset >= _scrollController.position.maxScrollExtent && !_scrollController.position.outOfRange) { log('at the bottom!'); } if (_scrollController.offset <= _scrollController.position.minScrollExtent && !_scrollController.position.outOfRange) { log('at the top!'); } } @override void initState() { super.initState(); _scrollController = ScrollController(); _scrollController.addListener(_scrollListener); } @override void dispose() { _scrollController.removeListener(_scrollListener); super.dispose(); } @override Widget build(BuildContext context) { return FutureBuilder( future: mockService.getExploreData(), builder: (context, AsyncSnapshot<ExploreData> snapshot) { if (snapshot.connectionState == ConnectionState.done) { final recipes = snapshot.data?.todayRecipes ?? []; final friendPosts = snapshot.data?.friendPosts ?? []; return ListView( scrollDirection: Axis.vertical, controller: _scrollController, children: [ TodayRecipeListView(recipes: recipes), const SizedBox(height: 16), FriendPostListView(friendPosts: friendPosts), ], ); } else { return const Center(child: CircularProgressIndicator()); } }, ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/screens/empty_grocery_screen.dart
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; import '../utils/tab_manager.dart'; class EmptyGroceryScreen extends StatelessWidget { const EmptyGroceryScreen({super.key}); @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(30.0), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Flexible( child: AspectRatio( aspectRatio: 1 / 1, child: Image.asset('assets/images/empty_list.png'), ), ), Text( AppLocalizations.of(context)!.noGroceries, style: Theme.of(context).textTheme.titleLarge, ), const SizedBox(height: 16), Text( '${AppLocalizations.of(context)!.shoppingForIngredients}\n' '${AppLocalizations.of(context)!.tapButton}', textAlign: TextAlign.center, ), MaterialButton( onPressed: () { Provider.of<TabManager>(context, listen: false).goToRecipes(); }, textColor: Colors.white, color: Colors.green, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30.0), ), child: Text(AppLocalizations.of(context)!.browseRecipes), ), ], ), ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/screens/grocery_list_screen.dart
import 'package:flutter/material.dart'; import '../utils/grocery_manager.dart'; import '../widgets/grocery_tile.dart'; import 'grocery_item_screen.dart'; class GroceryListScreen extends StatelessWidget { const GroceryListScreen({ super.key, required this.groceryManager, }); final GroceryManager groceryManager; @override Widget build(BuildContext context) { final groceryItems = groceryManager.groceryItems; return Padding( padding: const EdgeInsets.all(16.0), child: ListView.separated( itemBuilder: (context, index) { final item = groceryItems[index]; return Dismissible( key: Key(item.id), direction: DismissDirection.endToStart, background: Container( alignment: Alignment.centerRight, color: Colors.red, child: const Icon( Icons.delete_forever, color: Colors.white, size: 50.0, ), ), onDismissed: (direction) { groceryManager.deleteItem(index); ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('${item.name} dismissed')), ); }, child: InkWell( child: GroceryTile( key: Key(item.id), item: item, onComplete: (change) { if (change != null) { groceryManager.completeItem(index, change); } }, ), onTap: () { final json = item.copyWith(index: index).toJson(); Navigator.restorablePushNamed( context, GroceryItemScreen.routeName, arguments: json, ); }, ), ); }, separatorBuilder: (context, index) { return const SizedBox(height: 16); }, itemCount: groceryItems.length, ), ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/screens/grocery_item_screen.dart
import 'package:flutter/material.dart'; import 'package:flutter_colorpicker/flutter_colorpicker.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; import 'package:uuid/uuid.dart'; import '../models/grocery_item.dart'; import '../utils/set_page_title.dart'; import '../widgets/grocery_tile.dart'; class GroceryItemScreen extends StatefulWidget { const GroceryItemScreen({ super.key, required this.onCreate, required this.onUpdate, this.originalItem, }) : isUpdating = (originalItem != null); static const routeName = '/grocery_item'; final Function(GroceryItem) onCreate; final Function(GroceryItem) onUpdate; final GroceryItem? originalItem; final bool isUpdating; @override State<GroceryItemScreen> createState() => _GroceryItemScreenState(); } class _GroceryItemScreenState extends State<GroceryItemScreen> { final _nameController = TextEditingController(); String _name = ''; Importance _importance = Importance.low; Color _currentColor = Colors.green; // Stores the quantity of an item. int _currentSliderValue = 0; DateTime _dueDate = DateTime.now(); TimeOfDay _timeOfDay = TimeOfDay.now(); @override void initState() { super.initState(); final originalItem = widget.originalItem; // When the originalItem is not null, the user is editing an existing item. // In this case, you must configure the widget to show the item's values. if (originalItem != null) { _nameController.text = originalItem.name; _name = originalItem.name; _importance = originalItem.importance; _currentColor = originalItem.color; _currentSliderValue = originalItem.quantity; final date = originalItem.date; _dueDate = date; _timeOfDay = TimeOfDay(hour: date.hour, minute: date.minute); } // Adds a listener to listen for text field changes. When the text changes, // you set the _name. _nameController.addListener(() { setState(() => _name = _nameController.text); }); } @override void dispose() { // This will dispose your TextEditingController when you no longer need it. _nameController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { setPageTitle(AppLocalizations.of(context)!.groceryItem, context); return Scaffold( appBar: AppBar( actions: [ IconButton( onPressed: () { final groceryItem = GroceryItem( id: widget.originalItem?.id ?? const Uuid().v1(), name: _nameController.text, importance: _importance, color: _currentColor, quantity: _currentSliderValue, date: DateTime( _dueDate.year, _dueDate.month, _dueDate.day, _timeOfDay.hour, _timeOfDay.minute, ), isComplete: widget.originalItem?.isComplete ?? false, index: widget.originalItem?.index, ); if (widget.isUpdating) { widget.onUpdate(groceryItem); } else { widget.onCreate(groceryItem); } }, icon: const Icon(Icons.check), ), ], elevation: 0.0, title: Text( AppLocalizations.of(context)!.groceryItem, style: GoogleFonts.lato(fontWeight: FontWeight.w600), ), ), body: Container( padding: const EdgeInsets.all(16.0), child: ListView( children: [ buildNameField(), const SizedBox(height: 10), buildImportanceField(), buildDateField(context), buildTimeField(context), const SizedBox(height: 10), buildColorPicker(context), const SizedBox(height: 10), buildQuantityField(), GroceryTile( item: GroceryItem( id: 'previewMode', name: _name, importance: _importance, color: _currentColor, quantity: _currentSliderValue, date: DateTime( _dueDate.year, _dueDate.month, _dueDate.day, _timeOfDay.hour, _timeOfDay.minute, ), ), ), ], ), ), ); } Widget buildNameField() { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( AppLocalizations.of(context)!.itemName, style: GoogleFonts.lato(fontSize: 28.0), ), TextField( controller: _nameController, cursorColor: _currentColor, decoration: InputDecoration( hintText: 'E.g. Apples, Banana, 1 Bag of salt', enabledBorder: const UnderlineInputBorder( borderSide: BorderSide(color: Colors.white), ), focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: _currentColor), ), border: UnderlineInputBorder( borderSide: BorderSide(color: _currentColor), ), ), ), ], ); } Widget buildImportanceField() { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( AppLocalizations.of(context)!.importance, style: GoogleFonts.lato(fontSize: 28.0), ), Wrap( spacing: 10.0, children: [ ChoiceChip( label: Text( AppLocalizations.of(context)!.importanceLow, style: const TextStyle(color: Colors.white), ), selected: _importance == Importance.low, selectedColor: Colors.black, onSelected: (selected) { setState(() => _importance = Importance.low); }, ), ChoiceChip( label: Text( AppLocalizations.of(context)!.importanceMedium, style: const TextStyle(color: Colors.white), ), selected: _importance == Importance.medium, selectedColor: Colors.black, onSelected: (selected) { setState(() => _importance = Importance.medium); }, ), ChoiceChip( label: Text( AppLocalizations.of(context)!.importanceHigh, style: const TextStyle(color: Colors.white), ), selected: _importance == Importance.high, selectedColor: Colors.black, onSelected: (selected) { setState(() => _importance = Importance.high); }, ), ], ), ], ); } Widget buildDateField(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( AppLocalizations.of(context)!.date, style: GoogleFonts.lato(fontSize: 28.0), ), TextButton( child: Text(AppLocalizations.of(context)!.select), onPressed: () async { final currentDate = DateTime.now(); final selectedDate = await showDatePicker( context: context, initialDate: currentDate, firstDate: currentDate, lastDate: DateTime(currentDate.year + 5), ); setState(() { if (selectedDate != null) _dueDate = selectedDate; }); }, ), ], ), Text(DateFormat('yyyy-MM-dd').format(_dueDate)), ], ); } Widget buildTimeField(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( AppLocalizations.of(context)!.timeOfDay, style: GoogleFonts.lato(fontSize: 28.0), ), TextButton( child: Text(AppLocalizations.of(context)!.select), onPressed: () async { final timeOfDay = await showTimePicker( context: context, initialTime: TimeOfDay.now(), ); setState(() { if (timeOfDay != null) _timeOfDay = timeOfDay; }); }, ), ], ), Text(_timeOfDay.format(context)), ], ); } Widget buildColorPicker(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Container( height: 50.0, width: 10.0, color: _currentColor, ), const SizedBox(width: 8), Text( AppLocalizations.of(context)!.color, style: GoogleFonts.lato(fontSize: 28.0), ), ], ), TextButton( child: Text(AppLocalizations.of(context)!.select), onPressed: () async { showDialog( context: context, builder: (context) { return AlertDialog( content: BlockPicker( pickerColor: Colors.white, onColorChanged: (color) { setState(() => _currentColor = color); }, ), actions: [ TextButton( child: Text(AppLocalizations.of(context)!.save), onPressed: () { Navigator.of(context).pop(); }, ), ], ); }, ); }, ), ], ); } Widget buildQuantityField() { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( crossAxisAlignment: CrossAxisAlignment.baseline, textBaseline: TextBaseline.alphabetic, children: [ Text( AppLocalizations.of(context)!.quantity, style: GoogleFonts.lato(fontSize: 28.0), ), const SizedBox(width: 16), Text( _currentSliderValue.toInt().toString(), style: GoogleFonts.lato(fontSize: 18.0), ), ], ), Slider( value: _currentSliderValue.toDouble(), inactiveColor: _currentColor.withOpacity(0.5), activeColor: _currentColor, min: 0.0, max: 100.0, divisions: 100, label: _currentSliderValue.toInt().toString(), onChanged: (value) { setState(() => _currentSliderValue = value.toInt()); }, ), ], ); } }
0
mirrored_repositories/foodie/lib/src
mirrored_repositories/foodie/lib/src/screens/grocery_screen.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../utils/grocery_manager.dart'; import 'empty_grocery_screen.dart'; import 'grocery_item_screen.dart'; import 'grocery_list_screen.dart'; class GroceryScreen extends StatelessWidget { const GroceryScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( floatingActionButton: FloatingActionButton( child: const Icon(Icons.add), onPressed: () { // Navigate to the grocery item page. If the user leaves and returns // to the app after it has been killed while running in the // background, the navigation stack is restored. Navigator.restorablePushNamed( context, GroceryItemScreen.routeName, ); }, ), body: buildGroceryScreen(), ); } Widget buildGroceryScreen() { return Consumer<GroceryManager>( builder: (context, groceryManager, child) { if (groceryManager.groceryItems.isNotEmpty) { return GroceryListScreen(groceryManager: groceryManager); } else { return const EmptyGroceryScreen(); } }, ); } }
0
mirrored_repositories/foodie
mirrored_repositories/foodie/test/unit_test.dart
// This is an example unit test. // // A unit test tests a single function, method, or class. To learn more about // writing unit tests, visit // https://flutter.dev/docs/cookbook/testing/unit/introduction import 'package:flutter_test/flutter_test.dart'; void main() { group('Plus Operator', () { test('should add two numbers together', () { expect(1 + 1, 2); }); }); }
0
mirrored_repositories/foodie
mirrored_repositories/foodie/test/widget_test.dart
// This is an example 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. // // Visit https://flutter.dev/docs/cookbook/testing/widget/introduction for // more information about Widget testing. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('MyWidget', () { testWidgets('should display a string of text', (WidgetTester tester) async { // Define a Widget const myWidget = MaterialApp( home: Scaffold( body: Text('Hello'), ), ); // Build myWidget and trigger a frame. await tester.pumpWidget(myWidget); // Verify myWidget shows some text expect(find.byType(Text), findsOneWidget); }); }); }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/constants.dart
// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; var textColor = Color(0xff535353); var textColorLight = Color(0xffACACAC);
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/main.dart
// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; import 'package:store_app_ui/constants.dart'; import 'package:store_app_ui/screens/screen.home/homescreen.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); //$$$$$$$$$$$$$$$$$$$$$$$$$ //** Instagram : // ** @CodeWithFlexz // ---------------- //** Github : // ** AmirBayat0 // ---------------- //** Youtube : // ** Programming with Flexz //$$$$$$$$$$$$$$$$$$$$$$$$$ @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( textTheme: Theme.of(context).textTheme.apply(bodyColor: textColor), ), home: HomeScreen(), ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/model/products.dart
import 'package:flutter/cupertino.dart'; class Products { String image; String title; String description; int price; int size; Color color; Products( {required this.image, required this.title, required this.description, required this.price, required this.size, required this.color}); } List<Products> products = [ Products( title: "Office Code", price: 234, size: 12, description: dummyText, image: "assets/images/bag_1.png", color: Color(0xFF3D82AE)), Products( title: "Belt Bag", price: 234, size: 8, description: dummyText, image: "assets/images/bag_2.png", color: Color(0xFFD3A984)), Products( title: "Hang Top", price: 234, size: 10, description: dummyText, image: "assets/images/bag_3.png", color: Color(0xFF989493)), Products( title: "Old Fashion", price: 234, size: 11, description: dummyText, image: "assets/images/bag_4.png", color: Color(0xFFE6B398)), Products( title: "Office Code", price: 234, size: 12, description: dummyText, image: "assets/images/bag_5.png", color: Color(0xFFFB7883)), Products( title: "Office Code", price: 234, size: 12, description: dummyText, image: "assets/images/bag_6.png", color: Color(0xFFAEAEAE), ), Products( title: "Office Code", price: 234, size: 12, description: dummyText, image: "assets/images/bag_1.png", color: Color(0xFF3D82AE)), Products( title: "Belt Bag", price: 234, size: 8, description: dummyText, image: "assets/images/bag_2.png", color: Color(0xFFD3A984)), Products( title: "Hang Top", price: 234, size: 10, description: dummyText, image: "assets/images/bag_3.png", color: Color(0xFF989493)), Products( title: "Old Fashion", price: 234, size: 11, description: dummyText, image: "assets/images/bag_4.png", color: Color(0xFFE6B398)), Products( title: "Office Code", price: 234, size: 12, description: dummyText, image: "assets/images/bag_5.png", color: Color(0xFFFB7883)), Products( title: "Office Code", price: 234, size: 12, description: dummyText, image: "assets/images/bag_6.png", color: Color(0xFFAEAEAE), ), ]; String dummyText = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since. When an unknown printer took a galley.";
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/screen.home/homescreen.dart
// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; import 'package:store_app_ui/constants.dart'; import 'package:store_app_ui/screens/screen.home/components/body.dart'; class HomeScreen extends StatelessWidget { const HomeScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: buildAppBar(), body: Body(), ); } // AppBar Codes buildAppBar() { return PreferredSize( preferredSize: Size.fromHeight(70), child: AppBar( leading: Padding( padding: const EdgeInsets.only(top: 10), child: IconButton( icon: Icon( Icons.arrow_back, size: 35, color: textColor, ), onPressed: () {}, ), ), actions: [ Padding( padding: const EdgeInsets.only(top: 10), child: IconButton( icon: Icon( Icons.shopping_cart_outlined, size: 35, color: textColor, ), onPressed: () {}, ), ), Padding( padding: const EdgeInsets.only(top: 10, right: 10), child: IconButton( icon: Icon( Icons.search, size: 35, color: textColor, ), onPressed: () {}, ), ), ], backgroundColor: Colors.transparent, elevation: 0, ), ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/screen.home
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/screen.home/components/categories.dart
// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; import 'package:store_app_ui/constants.dart'; class CateGories extends StatefulWidget { const CateGories({Key? key}) : super(key: key); @override _CateGoriesState createState() => _CateGoriesState(); } class _CateGoriesState extends State<CateGories> { List<String> categories = [ "HandBag", "Jewellery", "Footwear", "Dresses", "BackPack", "Duffel", ]; int selectedIndex = 0; @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(top: 13), child: SizedBox( height: 50, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: categories.length, itemBuilder: (BuildContext context, int index) { return GestureDetector( onTap: () { setState(() { selectedIndex = index; }); }, child: Container( margin: EdgeInsets.symmetric(horizontal: 20), child: Column( children: [ Text( categories[index], style: TextStyle( fontSize: 25, fontWeight: FontWeight.bold, color: index == selectedIndex ? textColor : textColorLight), ), SizedBox( height: 10, ), Container( color: index == selectedIndex ? Colors.blue : Colors.transparent, height: 2, width: 70, ) ], ), ), ); }, ), ), ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/screen.home
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/screen.home/components/body.dart
// ignore_for_file: avoid_unnecessary_containers, prefer_const_constructors, non_constant_identifier_names import 'package:flutter/material.dart'; import 'package:store_app_ui/constants.dart'; import 'package:store_app_ui/model/products.dart'; import 'package:store_app_ui/screens/detailscreen/details_screen.dart'; import 'package:store_app_ui/screens/screen.home/components/categories.dart'; class Body extends StatelessWidget { const Body({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: EdgeInsets.symmetric(horizontal: 15), child: Text( "Women", style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold), ), ), CateGories(), Expanded( child: Container( margin: EdgeInsets.all(20), child: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 20, mainAxisSpacing: 20, childAspectRatio: 0.78, ), itemCount: products.length, itemBuilder: (BuildContext context, int index) { Products product = products[index]; return GestureDetector( onTap: () => Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) { return DetailsScreen(product: product); })), child: Container( child: Container( child: Column( children: [ Container( height: 200, width: 200, padding: EdgeInsets.all(10), decoration: BoxDecoration( color: product.color, borderRadius: BorderRadius.circular(10)), child: Image( image: AssetImage(product.image), ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: double.infinity, margin: EdgeInsets.only(top: 10), child: Text( " ${products[index].title}", style: TextStyle( color: textColorLight, fontWeight: FontWeight.w700, fontSize: 25, ), ), ), Container( child: Text( " \$${products[index].price.toString()}", style: TextStyle( color: textColor, fontWeight: FontWeight.bold, fontSize: 25, ), ), ), ], ), ], ), ), ), ); }, ), ), ), ], ), ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen/details_screen.dart
// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; import 'package:store_app_ui/model/products.dart'; import 'package:store_app_ui/screens/detailscreen/components/body.dart'; class DetailsScreen extends StatelessWidget { final Products product; DetailsScreen({required this.product}); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: product.color, appBar: buildAppBar(onTap: () { Navigator.pop(context); }), body: Body(product: product), ); } buildAppBar({required onTap}) { return PreferredSize( preferredSize: Size.fromHeight(70), child: AppBar( leading: Padding( padding: const EdgeInsets.only(top: 10), child: IconButton( icon: Icon( Icons.arrow_back, size: 35, color: Colors.white, ), onPressed: onTap, ), ), actions: [ Padding( padding: const EdgeInsets.only(top: 10), child: IconButton( icon: Icon( Icons.shopping_cart_outlined, size: 35, color: Colors.white, ), onPressed: () {}, ), ), Padding( padding: const EdgeInsets.only(top: 10, right: 10), child: IconButton( icon: Icon( Icons.search, size: 35, color: Colors.white, ), onPressed: () {}, ), ), ], backgroundColor: Colors.transparent, elevation: 0, ), ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen/components/color_and_size.dart
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables import 'package:flutter/material.dart'; import 'package:store_app_ui/model/products.dart'; class ColorAndSize extends StatelessWidget { final Products product; ColorAndSize({required this.product}); @override Widget build(BuildContext context) { return Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Color", style: TextStyle( fontSize: 23, fontWeight: FontWeight.w600, ), ), Row( children: [ ColorDot( isSelected: true, color: Color(0xFF3D82AE), ), ColorDot( isSelected: false, color: Color(0xFF989493), ), ColorDot( isSelected: false, color: Color(0xFFE6B398), ), ], ) ], ), ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Size", style: TextStyle( fontSize: 23, fontWeight: FontWeight.w600, ), ), Text( "${product.size} cm", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 30, ), ) ], ), ) ], ); } } class ColorDot extends StatelessWidget { bool isSelected = false; Color color; ColorDot({required this.isSelected, required this.color}); @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(top: 5, right: 10), padding: EdgeInsets.all(2.5), width: 28, height: 28, decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( color: isSelected ? color : Colors.transparent, width: 2 )), child: DecoratedBox( decoration: BoxDecoration(color: color, shape: BoxShape.circle), ), ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen/components/description.dart
import 'package:flutter/material.dart'; import 'package:store_app_ui/constants.dart'; import 'package:store_app_ui/model/products.dart'; class Description extends StatelessWidget { final Products product; Description({required this.product}); @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.only(right: 5), child: Text(product.description,style: TextStyle(color: textColor,fontSize: 20,fontWeight: FontWeight.w600),), ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen/components/cart_counter.dart
// ignore_for_file: deprecated_member_use, prefer_const_constructors import 'package:flutter/material.dart'; class CartCounter extends StatefulWidget { CartCounter({Key? key}) : super(key: key); @override _CartCounterState createState() => _CartCounterState(); } class _CartCounterState extends State<CartCounter> { int numOfItems = 1; @override Widget build(BuildContext context) { return Row( children: [ SizedBox( width: 50, height: 40, child: OutlineButton( onPressed: () { setState(() { if(numOfItems>1){ numOfItems--; } }); }, padding: EdgeInsets.zero, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15), ), child: Icon(Icons.remove), ), ), Container( padding: EdgeInsets.symmetric(horizontal: 15), child: Text( numOfItems.toString().padLeft(2,""), style: TextStyle(fontSize: 25,fontWeight: FontWeight.w600), ), ), SizedBox( width: 50, height: 40, child: OutlineButton( onPressed: () { setState(() { numOfItems++; }); }, padding: EdgeInsets.zero, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15), ), child: Icon(Icons.add)), ), ], ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen/components/conter_b.dart
// ignore_for_file: prefer_const_literals_to_create_immutables, prefer_const_constructors import 'package:flutter/material.dart'; import 'package:store_app_ui/model/products.dart'; import 'package:store_app_ui/screens/detailscreen/components/cart_counter.dart'; class ConterB extends StatelessWidget { final Products product; ConterB({required this.product}); @override Widget build(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ CartCounter(), Container( width: 52, height: 52, decoration: BoxDecoration( color: product.color, borderRadius: BorderRadius.circular(30), ), child: Icon( Icons.thumb_up_outlined, size: 40, ), ) ], ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen/components/prouct_title.dart
// ignore_for_file: prefer_const_literals_to_create_immutables, avoid_unnecessary_containers, prefer_const_constructors import 'package:flutter/material.dart'; import 'package:store_app_ui/model/products.dart'; class ProuctTitle extends StatelessWidget { final Products product; ProuctTitle({required this.product}); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.symmetric(horizontal: 20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Arisoco Hand Bag", style: TextStyle(color: Colors.white, fontSize: 20), ), SizedBox( height: 5, ), Text( product.title, style: TextStyle( color: Colors.white, fontSize: 50, fontWeight: FontWeight.bold), ), SizedBox(height: 30,), Row( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Price", style: TextStyle( fontSize: 25, color: Colors.white, fontWeight: FontWeight.w600), ), Text( "\$${product.price.toString()}", style: TextStyle( fontSize: 45, color: Colors.white, fontWeight: FontWeight.bold), ), ], ), SizedBox(width: 50,), Container( width: 250, height: 250, child: Image.asset( product.image, fit: BoxFit.fill, ), ) ], ), ], ), ); } }
0
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen
mirrored_repositories/Bag-Shop-UI-using-Flutter/Store UI/store_app_ui/lib/screens/detailscreen/components/body.dart
// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; import 'package:store_app_ui/model/products.dart'; import 'package:store_app_ui/screens/detailscreen/components/conter_b.dart'; import 'package:store_app_ui/screens/detailscreen/components/description.dart'; import 'package:store_app_ui/screens/detailscreen/components/prouct_title.dart'; import 'color_and_size.dart'; class Body extends StatelessWidget { final Products product; Body({required this.product}); @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return SingleChildScrollView( child: Column( children: [ SizedBox( height: size.height, child: Stack( children: [ Container( margin: EdgeInsets.only(top: size.height * 0.3), padding: EdgeInsets.only( left: 25, right: 10, top: size.height * 0.12), decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(25), topRight: Radius.circular(25), ), color: Colors.white), child: Column( children: [ ColorAndSize( product: product, ), SizedBox( height: 20, ), Description( product: product, ), SizedBox( height: 20, ), ConterB( product: product, ), SizedBox(height: 40,), Row( children: [ SizedBox( width: 80, height: 80, // ignore: deprecated_member_use child: OutlineButton( textColor: product.color, highlightedBorderColor: product.color, borderSide: BorderSide(color: product.color, width: 3), onPressed: () {}, padding: EdgeInsets.zero, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(25), ), child: Icon( Icons.add_shopping_cart, size: 50, color: product.color, ), ), ), SizedBox( width: 30, ), Container( width: 320, height: 80, decoration: BoxDecoration(color: product.color, borderRadius: BorderRadius.circular(25)), child: MaterialButton( onPressed: () {}, child: Text( "BUY NOW", style: TextStyle( fontSize: 30, color: Colors.white, fontWeight: FontWeight.bold), ), ), ) ], ) ], ), ), ProuctTitle(product: product) ], ), ), ], ), ); } }
0
mirrored_repositories/tuna_rungu_apps
mirrored_repositories/tuna_rungu_apps/lib/firebase_options.dart
// File generated by FlutterFire CLI. // ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; /// Default [FirebaseOptions] for use with your Firebase apps. /// /// Example: /// ```dart /// import 'firebase_options.dart'; /// // ... /// await Firebase.initializeApp( /// options: DefaultFirebaseOptions.currentPlatform, /// ); /// ``` class DefaultFirebaseOptions { static FirebaseOptions get currentPlatform { if (kIsWeb) { return web; } switch (defaultTargetPlatform) { case TargetPlatform.android: return android; case TargetPlatform.iOS: return ios; case TargetPlatform.macOS: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for macos - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); case TargetPlatform.windows: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for windows - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); case TargetPlatform.linux: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for linux - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); default: throw UnsupportedError( 'DefaultFirebaseOptions are not supported for this platform.', ); } } static const FirebaseOptions web = FirebaseOptions( apiKey: 'AIzaSyBiy23qIxaeKfrerTkC78uxTj4AS2mmu48', appId: '1:700325275973:web:063b6e4240c608519e362c', messagingSenderId: '700325275973', projectId: 'imk-kel-1', authDomain: 'imk-kel-1.firebaseapp.com', storageBucket: 'imk-kel-1.appspot.com', ); static const FirebaseOptions android = FirebaseOptions( apiKey: 'AIzaSyBRWAOlP0bZRhJ4dwO9ahp7ZIMq7x8IP-A', appId: '1:700325275973:android:b8981f3b76adf3cc9e362c', messagingSenderId: '700325275973', projectId: 'imk-kel-1', storageBucket: 'imk-kel-1.appspot.com', ); static const FirebaseOptions ios = FirebaseOptions( apiKey: 'AIzaSyAgM3Xqw0gClmYbukNna880_9ius9qYfu4', appId: '1:700325275973:ios:7fb64f35ba1dbae59e362c', messagingSenderId: '700325275973', projectId: 'imk-kel-1', storageBucket: 'imk-kel-1.appspot.com', iosClientId: '700325275973-uc0npmiamtg5aak9vobtfrkb5othti6b.apps.googleusercontent.com', iosBundleId: 'com.example.tunaRunguApps', ); }
0
mirrored_repositories/tuna_rungu_apps
mirrored_repositories/tuna_rungu_apps/lib/main.dart
import 'package:flutter/material.dart'; import 'package:tuna_rungu_apps/pages/login.dart'; // Firebase import 'package:firebase_core/firebase_core.dart'; import 'firebase_options.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Tuna Rungu Apps', theme: ThemeData( fontFamily: 'Poppins', colorScheme: ColorScheme.fromSwatch().copyWith( primary: const Color(0xFFF5A21D), secondary: const Color(0xFFFFF4D2), ), ), home: const LoginPage(), ); } }
0
mirrored_repositories/tuna_rungu_apps/lib
mirrored_repositories/tuna_rungu_apps/lib/pages/register.dart
import 'dart:async'; import 'package:flutter/material.dart'; import 'package:iconsax/iconsax.dart'; // Firebase import 'package:firebase_auth/firebase_auth.dart'; import 'package:tuna_rungu_apps/pages/login.dart'; Route _createRoute() { return PageRouteBuilder( pageBuilder: (context, animation, secondaryAnimation) => const LoginPage(), transitionsBuilder: (context, animation, secondaryAnimation, child) { const begin = Offset(1.0, 0.0); const end = Offset.zero; const curve = Curves.ease; var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve)); return SlideTransition( position: animation.drive(tween), child: child, ); }, ); } class RegisterPage extends StatefulWidget { const RegisterPage({Key? key}) : super(key: key); @override State<RegisterPage> createState() => _RegisterPageState(); } class _RegisterPageState extends State<RegisterPage> { final namaController = TextEditingController(); final emailController = TextEditingController(); final passwordController = TextEditingController(); var _isObscure = true; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFFF9FAFB), body: CustomScrollView( slivers: [ SliverFillRemaining( hasScrollBody: false, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( color: const Color(0xFFFFF4D2), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), child: SafeArea( child: Row( children: [ IconButton( iconSize: 24, padding: const EdgeInsets.all(0), alignment: Alignment.centerLeft, onPressed: () { Navigator.pop(context); }, icon: const Icon( Iconsax.arrow_left, ), color: const Color(0xFF475467), ), const Text( "Kembali", style: TextStyle( color: Color(0xFF475467), fontSize: 16, ), ), ], ), ), ), Expanded( child: Padding( padding: const EdgeInsets.only( left: 16, right: 16, bottom: 16, top: 32), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( "Daftar", style: TextStyle( color: Color(0xFF1D2939), fontWeight: FontWeight.bold, fontSize: 24, ), ), const SizedBox( height: 12, ), const Text( "Harap memasukkan email yang aktif", style: TextStyle( color: Color(0xFF667085), fontSize: 16, ), ), const SizedBox( height: 32, ), const Text( "Nama", style: TextStyle( color: Color(0xFF344054), fontWeight: FontWeight.w500, fontSize: 14, ), ), const SizedBox( height: 6, ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: Border.all( color: const Color(0xFFD0D5DD), ), color: Colors.white, boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), child: TextField( style: const TextStyle(fontSize: 16), controller: namaController, decoration: const InputDecoration( border: InputBorder.none, hintText: "Nama", contentPadding: EdgeInsets.only( left: 14, right: 14, top: 10, bottom: 10), ), ), ), const SizedBox( height: 20, ), const Text( "Email", style: TextStyle( color: Color(0xFF344054), fontWeight: FontWeight.w500, fontSize: 14, ), ), const SizedBox( height: 6, ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: Border.all( color: const Color(0xFFD0D5DD), ), color: Colors.white, boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), child: TextField( style: const TextStyle(fontSize: 16), controller: emailController, decoration: const InputDecoration( border: InputBorder.none, hintText: "Email", contentPadding: EdgeInsets.only( left: 14, right: 14, top: 10, bottom: 10), ), ), ), const SizedBox( height: 20, ), const Text( "Password", style: TextStyle( color: Color(0xFF344054), fontWeight: FontWeight.w500, fontSize: 14, ), ), const SizedBox( height: 6, ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: Border.all( color: const Color(0xFFD0D5DD), ), color: Colors.white, boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), child: TextField( style: const TextStyle(fontSize: 16), obscureText: _isObscure, controller: passwordController, decoration: InputDecoration( border: InputBorder.none, hintText: "Password", contentPadding: const EdgeInsets.only( left: 14, right: 14, top: 10, bottom: 10), suffixIcon: IconButton( onPressed: () { setState(() { if (_isObscure == true) { _isObscure = false; } else { _isObscure = true; } }); }, icon: Icon( _isObscure ? Icons.visibility : Icons.visibility_off, ), ), ), ), ), const SizedBox( height: 40, ), Flexible( child: Align( alignment: const Alignment(0, 0.5), child: InkWell( onTap: () => showDialog( context: context, builder: (BuildContext context) => Register( email: emailController.text, password: passwordController.text, displayName: namaController.text, ), ), child: Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: const Color(0xFFF5A21D), border: Border.all( color: const Color(0xFFF5A21D), ), boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), padding: const EdgeInsets.symmetric( vertical: 10, horizontal: 16), child: const Text( "Daftar", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14, ), ), ), ), ), ), ], ), ), ), ], ), ), ], ), ); } } class Register extends StatefulWidget { final String email; final String password; final String displayName; const Register( {Key? key, required this.email, required this.password, required this.displayName}) : super(key: key); @override _RegisterState createState() => _RegisterState(); } class _RegisterState extends State<Register> { String _msg = ""; @override void initState() { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) { _asyncMethod(); }); } _asyncMethod() async { try { final credential = await FirebaseAuth.instance.createUserWithEmailAndPassword( email: widget.email, password: widget.password, ); User? user = credential.user; user?.updateDisplayName(widget.displayName); if (credential.additionalUserInfo?.isNewUser == true) { setState(() { _msg = "Akun berhasil didaftarkan, silahkan tunggu beberapa detik..."; Timer(const Duration(seconds: 3), () { Navigator.of(context).push(_createRoute()); }); }); } } on FirebaseAuthException catch (e) { if (e.code == 'weak-password') { setState(() { _msg = 'Password yang dimasukkan lemah.'; }); } else if (e.code == 'email-already-in-use') { setState(() { _msg = 'Email sudah ada.'; }); } } // catch (e) { // print(e); // } } @override Widget build(BuildContext context) { return AlertDialog(content: Text(_msg)); } }
0
mirrored_repositories/tuna_rungu_apps/lib
mirrored_repositories/tuna_rungu_apps/lib/pages/profile.dart
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:iconsax/iconsax.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:image_picker/image_picker.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:path/path.dart'; class ProfilePage extends StatefulWidget { final String displayName; final String email; final String photoURL; const ProfilePage( {Key? key, required this.email, required this.displayName, required this.photoURL}) : super(key: key); @override State<ProfilePage> createState() => _ProfilePageState(); } class _ProfilePageState extends State<ProfilePage> { final changeDisplayName = TextEditingController(); final changeEmail = TextEditingController(); final changePassword = TextEditingController(); // @override // void initState() { // super.initState(); // FirebaseAuth.instance.authStateChanges().listen((User? user) async { // if (user != null) { // print(user.displayName); // } // }); // } void changeDisplayNameFirebase(displayName) { FirebaseAuth.instance.authStateChanges().listen((User? user) async { if (user != null) { await user.updateDisplayName(displayName); } }); } void changePhotoUrlFirebase(url) { FirebaseAuth.instance.authStateChanges().listen((User? user) async { if (user != null) { await user.updatePhotoURL(url); } }); } void changeEmailFirebase(email) { FirebaseAuth.instance.authStateChanges().listen((User? user) async { if (user != null) { await user.updateEmail(email); } }); } void changePasswordFirebase(password) { FirebaseAuth.instance.authStateChanges().listen((User? user) async { if (user != null) { await user.updatePassword(password); } }); } String getInitials(String displayName) => displayName.isNotEmpty ? displayName.trim().split(RegExp(' +')).map((s) => s[0]).take(2).join() : ''; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFFF5A21D), body: CustomScrollView( slivers: [ SliverFillRemaining( hasScrollBody: false, child: SafeArea( child: Container( height: double.infinity, decoration: const BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(24), topRight: Radius.circular(24), ), color: Colors.white, ), padding: const EdgeInsets.only(left: 16, right: 16, top: 24), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( children: [ IconButton( iconSize: 24, padding: const EdgeInsets.all(0), alignment: Alignment.centerLeft, onPressed: () { Navigator.pop(context); }, icon: const Icon( Iconsax.arrow_left, ), color: const Color(0xFF475467), ), const Text( "Kembali", style: TextStyle( color: Color(0xFF475467), fontSize: 16, ), ), ], ), const SizedBox( height: 32, ), CircleAvatar( radius: 60, backgroundColor: const Color(0xFFFFFCF2), foregroundColor: const Color(0xFFDB8818), child: widget.photoURL == "" ? Text( getInitials(widget.displayName), style: const TextStyle( color: Color(0xFFDB8818), fontSize: 48, fontWeight: FontWeight.w500, ), ) : Image.network( widget.photoURL, fit: BoxFit.fill, ), ), const SizedBox( height: 16, ), Text( widget.displayName, style: const TextStyle( color: Color(0xFF1D2939), fontWeight: FontWeight.bold, fontSize: 24, ), ), const SizedBox( height: 8, ), Text( widget.email, style: const TextStyle( color: Color(0xFF667085), fontSize: 14, ), ), const SizedBox( height: 64, ), InkWell( onTap: () => showDialog( context: context, builder: (BuildContext context) => AlertDialog( content: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ const Text( "Ubah Nama", style: TextStyle( color: Color(0xFF344054), fontWeight: FontWeight.w500, fontSize: 14, ), ), const SizedBox( height: 6, ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: Border.all( color: const Color(0xFFD0D5DD), ), color: Colors.white, boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), child: TextField( style: const TextStyle(fontSize: 16), controller: changeDisplayName, decoration: const InputDecoration( border: InputBorder.none, hintText: "Ubah Nama", contentPadding: EdgeInsets.only( left: 14, right: 14, top: 10, bottom: 10), ), ), ), const SizedBox( height: 10, ), Flexible( child: Align( alignment: const Alignment(0, 1), child: InkWell( onTap: () { changeDisplayNameFirebase( changeDisplayName.text); Navigator.pop(context); }, child: Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: const Color(0xFFF5A21D), border: Border.all( color: const Color(0xFFF5A21D), ), boxShadow: const [ BoxShadow( color: Color.fromRGBO( 16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), padding: const EdgeInsets.symmetric( vertical: 10, horizontal: 16), child: const Text( "Ubah", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14, ), ), ), ), ), ), ], ), ), ), ), child: Container( padding: const EdgeInsets.all(12), decoration: const BoxDecoration( border: Border( bottom: BorderSide( color: Color(0xFFEAECF0), ), ), ), child: Column( children: [ Row( children: const [ Icon( Iconsax.edit5, color: Color.fromRGBO(219, 136, 24, 0.7), ), SizedBox( width: 16, ), Text( "Ubah Nama", style: TextStyle( color: Color(0xFF344054), fontSize: 18, fontWeight: FontWeight.w500, ), ), ], ), ], ), ), ), InkWell( onTap: () => showDialog( context: context, builder: (BuildContext context) => AlertDialog( content: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ const Text( "Ubah Password", style: TextStyle( color: Color(0xFF344054), fontWeight: FontWeight.w500, fontSize: 14, ), ), const SizedBox( height: 6, ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: Border.all( color: const Color(0xFFD0D5DD), ), color: Colors.white, boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), child: TextField( style: const TextStyle(fontSize: 16), controller: changePassword, decoration: const InputDecoration( border: InputBorder.none, hintText: "Ubah Password", contentPadding: EdgeInsets.only( left: 14, right: 14, top: 10, bottom: 10), ), ), ), const SizedBox( height: 10, ), Flexible( child: Align( alignment: const Alignment(0, 1), child: InkWell( onTap: () { changePasswordFirebase( changePassword.text); Navigator.pop(context); }, child: Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: const Color(0xFFF5A21D), border: Border.all( color: const Color(0xFFF5A21D), ), boxShadow: const [ BoxShadow( color: Color.fromRGBO( 16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), padding: const EdgeInsets.symmetric( vertical: 10, horizontal: 16), child: const Text( "Ubah", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14, ), ), ), ), ), ), ], ), ), ), ), child: Container( padding: const EdgeInsets.all(12), decoration: const BoxDecoration( border: Border( bottom: BorderSide( color: Color(0xFFEAECF0), ), ), ), child: Column( children: [ Row( children: const [ Icon( Iconsax.lock5, color: Color.fromRGBO(219, 44, 62, 0.7), ), SizedBox( width: 16, ), Text( "Ubah password", style: TextStyle( color: Color(0xFF344054), fontSize: 18, fontWeight: FontWeight.w500, ), ), ], ), ], ), ), ), InkWell( onTap: () => showDialog( context: context, builder: (BuildContext context) => AlertDialog( content: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ const Text( "Ubah Email", style: TextStyle( color: Color(0xFF344054), fontWeight: FontWeight.w500, fontSize: 14, ), ), const SizedBox( height: 6, ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: Border.all( color: const Color(0xFFD0D5DD), ), color: Colors.white, boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), child: TextField( style: const TextStyle(fontSize: 16), controller: changeEmail, decoration: const InputDecoration( border: InputBorder.none, hintText: "Ubah Email", contentPadding: EdgeInsets.only( left: 14, right: 14, top: 10, bottom: 10), ), ), ), const SizedBox( height: 10, ), Flexible( child: Align( alignment: const Alignment(0, 1), child: InkWell( onTap: () { changeEmailFirebase(changeEmail.text); Navigator.pop(context); }, child: Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: const Color(0xFFF5A21D), border: Border.all( color: const Color(0xFFF5A21D), ), boxShadow: const [ BoxShadow( color: Color.fromRGBO( 16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), padding: const EdgeInsets.symmetric( vertical: 10, horizontal: 16), child: const Text( "Ubah", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14, ), ), ), ), ), ), ], ), ), ), ), child: Container( padding: const EdgeInsets.all(12), decoration: const BoxDecoration( border: Border( bottom: BorderSide( color: Color(0xFFEAECF0), ), ), ), child: Column( children: [ Row( children: const [ Icon( Iconsax.sms5, color: Color.fromRGBO(101, 203, 67, 0.7), ), SizedBox( width: 16, ), Text( "Ubah email", style: TextStyle( color: Color(0xFF344054), fontSize: 18, fontWeight: FontWeight.w500, ), ), ], ), ], ), ), ), InkWell( onTap: () => showDialog( context: context, builder: (BuildContext context) => AlertDialog( content: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: const [ Text( "Ubah Foto", style: TextStyle( color: Color(0xFF344054), fontWeight: FontWeight.w500, fontSize: 14, ), ), SizedBox( height: 6, ), UploadImageChangeDisplay(), ], ), ), ), ), child: Container( padding: const EdgeInsets.all(12), decoration: const BoxDecoration( border: Border( bottom: BorderSide( color: Color(0xFFEAECF0), ), ), ), child: Column( children: [ Row( children: const [ Icon( Iconsax.camera5, color: Color.fromRGBO(5, 137, 214, 0.7), ), SizedBox( width: 16, ), Text( "Ubah foto", style: TextStyle( color: Color(0xFF344054), fontSize: 18, fontWeight: FontWeight.w500, ), ), ], ), ], ), ), ), ], ), ), ), ), ], ), ); } } class UploadImageChangeDisplay extends StatefulWidget { const UploadImageChangeDisplay({Key? key}) : super(key: key); @override State<UploadImageChangeDisplay> createState() => UploadImageChangeDisplayState(); } class UploadImageChangeDisplayState extends State<UploadImageChangeDisplay> { late File _imageFile; bool _load = false; final ImagePicker picker = ImagePicker(); Future pickImage() async { final pickedFile = await picker.pickImage(source: ImageSource.gallery); setState(() { _imageFile = File(pickedFile!.path); _load = true; }); } Future uploadImage(BuildContext context) async { String fileName = basename(_imageFile.path); final storageRef = FirebaseStorage.instance.ref(); final imagesRef = storageRef.child("profile/picture/$fileName"); try { await imagesRef.putFile(_imageFile); await imagesRef.getDownloadURL().then( (url) => FirebaseAuth.instance.authStateChanges().listen( (User? user) async { if (user != null) { await user.updatePhotoURL(url); } }, ), ); } on FirebaseException catch (e) { // print(e); } } @override Widget build(BuildContext context) { return Column( children: [ ClipRRect( borderRadius: BorderRadius.circular(12.0), child: _load == true ? Image.file(_imageFile) : TextButton( child: const Icon( Icons.add_a_photo, size: 80, ), onPressed: pickImage, ), ), const SizedBox( height: 10, ), InkWell( onTap: () async { // print("haiii ubah foto "); uploadImage(context); Navigator.pop(context); }, child: Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: const Color(0xFFF5A21D), border: Border.all( color: const Color(0xFFF5A21D), ), boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), child: const Text( "Ubah", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14, ), ), ), ), ], ); } }
0
mirrored_repositories/tuna_rungu_apps/lib
mirrored_repositories/tuna_rungu_apps/lib/pages/tambahkata.dart
import 'package:flutter/material.dart'; import 'package:iconsax/iconsax.dart'; class TambahKataPage extends StatelessWidget { TambahKataPage({Key? key}) : super(key: key); final inputController = TextEditingController(); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFFF5A21D), body: SafeArea( child: Container( height: double.infinity, decoration: const BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(24), topRight: Radius.circular(24), ), color: Colors.white, ), padding: const EdgeInsets.only(left: 16, right: 16, top: 24), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ IconButton( iconSize: 24, padding: const EdgeInsets.all(0), alignment: Alignment.centerLeft, onPressed: () { Navigator.pop(context); }, icon: const Icon( Iconsax.arrow_left, ), color: const Color(0xFF475467), ), const Text( "Kembali", style: TextStyle( color: Color(0xFF475467), fontSize: 16, ), ), ], ), const SizedBox( height: 16, ), const Text( "Tambah Kata", style: TextStyle( color: Color(0xFF1D2939), fontWeight: FontWeight.bold, fontSize: 24, ), ), const SizedBox( height: 8, ), const Flexible( child: Text( "Anda dapat meminta untuk menambah kata dengan mengisi form dibawah ini", style: TextStyle( color: Color(0xFF667085), fontSize: 14, ), ), ), const SizedBox( height: 32, ), Flexible( child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), border: Border.all( color: const Color(0xFFD0D5DD), ), color: Colors.white, boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), child: TextField( style: const TextStyle(fontSize: 16), controller: inputController, maxLines: 5, decoration: const InputDecoration( border: InputBorder.none, hintText: "Tambah Kata", contentPadding: EdgeInsets.only( left: 14, right: 14, top: 10, bottom: 10), ), ), ), ), const SizedBox( height: 32, ), InkWell( onTap: () { if (inputController.text.isEmpty) { showDialog<String>( context: context, builder: (BuildContext context) => AlertDialog( title: const Text('Error'), content: const Text('Input form tidak boleh kosong.'), actions: <Widget>[ TextButton( onPressed: () => Navigator.pop(context), child: const Text('Kembali'), ), ], ), ); } else { showDialog<String>( context: context, builder: (BuildContext context) => AlertDialog( title: const Text('Tambah Kata'), content: const Text( 'Permintaan tambah kata berhasil. Permintaan anda akan melalui tahap review admin terlebih dahulu.'), actions: <Widget>[ TextButton( onPressed: () => Navigator.pop(context), child: const Text('Kembali'), ), ], ), ); } }, child: Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: const Color(0xFFF5A21D), border: Border.all( color: const Color(0xFFF5A21D), ), boxShadow: const [ BoxShadow( color: Color.fromRGBO(16, 24, 40, 0.05), blurRadius: 2, offset: Offset(0, 1), ), ], ), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), child: const Text( "Permintaan Tambah kata", textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14, ), ), ), ), ], ), ), ), ); } }
0