repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Widgets/change_theme_button_widget.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../Theme/theme_provider.dart'; class ChangeThemeButtonWidget extends StatelessWidget { @override Widget build(BuildContext context) { final themeProvider = Provider.of<ThemeProvider>(context); return Switch.adaptive( value: themeProvider.isDarkMode, onChanged: (value) { final provider = Provider.of<ThemeProvider>(context, listen: false); provider.toggleTheme(value); }, ); } }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Widgets/image_frames_widgets.dart
import 'package:flutter/material.dart'; class ImageFramesWidgets { userProfileFrame( profileImage, double width, double radius, bool isNetworkImage) { return isNetworkImage == true ? Container( width: width, alignment: Alignment.topLeft, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ profileImage != null ? CircleAvatar( backgroundImage: NetworkImage(profileImage), radius: radius, ) : CircleAvatar( backgroundImage: AssetImage( 'assets/images/trashpick_user_avatar.png'), radius: radius, ), ], ), ) : Container( height: 150.0, width: 150.0, child: CircleAvatar( backgroundImage: FileImage(profileImage), radius: 40, ), ); } }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Widgets/button_widgets.dart
import 'dart:ui'; import 'package:flutter/material.dart'; import '../Theme/theme_provider.dart'; class TextButtonWidget extends StatelessWidget { final String text; final Color color; final VoidCallback onClicked; const TextButtonWidget({ Key key, this.text, this.onClicked, this.color, }) : super(key: key); @override Widget build(BuildContext context) => TextButton( onPressed: onClicked, child: Text(text, style: TextStyle( fontSize: Theme.of(context).textTheme.button.fontSize, color: Colors.grey.shade900, fontWeight: FontWeight.bold, )), ); } class RadiusFlatButtonWidget extends StatelessWidget { final String text; final VoidCallback onClicked; const RadiusFlatButtonWidget({ Key key, this.text, this.onClicked, }) : super(key: key); @override Widget build(BuildContext context) => FlatButton( color: AppThemeData().redColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(18.0), ), child: Text(text, style: TextStyle( fontSize: Theme.of(context).textTheme.button.fontSize, fontWeight: FontWeight.bold, color: Colors.white)), onPressed: onClicked, ); } class ButtonWidget extends StatelessWidget { final String text; final Color textColor; final Color color; final VoidCallback onClicked; const ButtonWidget({ Key key, this.text, this.onClicked, this.textColor, this.color, }) : super(key: key); @override Widget build(BuildContext context) => Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Material( borderRadius: BorderRadius.circular(10.0), color: color, child: MaterialButton( minWidth: 250, onPressed: onClicked, child: Container( alignment: Alignment.center, child: Text(text, textAlign: TextAlign.center, style: TextStyle(fontFamily: 'Montserrat', fontSize: 18.0) .copyWith(color: textColor, fontWeight: FontWeight.bold)), ), ), ), ); } class MinButtonWidget extends StatelessWidget { final String text; final Color color; final VoidCallback onClicked; const MinButtonWidget({ Key key, this.text, this.onClicked, this.color, }) : super(key: key); @override Widget build(BuildContext context) => FlatButton( color: color, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), minWidth: 200.0, child: Text(text, style: TextStyle( fontSize: Theme.of(context).textTheme.button.fontSize, fontWeight: FontWeight.bold, color: Colors.white)), onPressed: onClicked, ); } class TextWithIconButtonWidget extends StatelessWidget { final String text; final IconData icon; final bool iconToLeft; final VoidCallback onClicked; const TextWithIconButtonWidget({ Key key, this.text, this.icon, this.iconToLeft, this.onClicked, }) : super(key: key); @override Widget build(BuildContext context) => InkWell( onTap: onClicked, child: Row( mainAxisSize: MainAxisSize.min, textDirection: iconToLeft ? TextDirection.ltr : TextDirection.rtl, children: [ Icon( icon, color: Theme.of(context).iconTheme.color, ), SizedBox( width: 10.0, ), Text(text, style: TextStyle( fontSize: Theme.of(context).textTheme.button.fontSize, color: Theme.of(context).textTheme.button.color, fontWeight: FontWeight.bold, )), ], ), ); } class ButtonWithIconWidget extends StatelessWidget { final Color buttonColor; final IconData icon; final Color iconColor; final String text; final Color textColor; final VoidCallback onClicked; const ButtonWithIconWidget({ Key key, this.buttonColor, this.icon, this.iconColor, this.text, this.textColor, this.onClicked, }) : super(key: key); @override Widget build(BuildContext context) => Material( borderRadius: BorderRadius.circular(12.0), color: buttonColor, child: MaterialButton( minWidth: 180.0, padding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), onPressed: onClicked, child: Row( mainAxisSize: MainAxisSize.min, children: [ Icon( icon, size: 20.0, color: iconColor, ), SizedBox(width: 8), Text(text, textAlign: TextAlign.center, style: TextStyle(fontSize: 16.0) .copyWith(color: textColor, fontWeight: FontWeight.bold)), ], ), ), ); } class ButtonWithImageWidget extends StatelessWidget { final String image; final Color color; final String text; final Color textColor; final VoidCallback onClicked; const ButtonWithImageWidget({ Key key, this.image, this.color, this.text, this.textColor, this.onClicked, }) : super(key: key); @override Widget build(BuildContext context) => Padding( padding: EdgeInsets.symmetric(horizontal: 20.0), child: Material( borderRadius: BorderRadius.circular(10.0), color: color, elevation: 2, child: MaterialButton( minWidth: 250, padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 30.0), onPressed: onClicked, child: Container( alignment: Alignment.centerLeft, child: Row( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( image, height: 25, width: 25, ), SizedBox(width: 10), Text(text, textAlign: TextAlign.center, style: TextStyle(fontFamily: 'Montserrat', fontSize: 16.0) .copyWith( color: textColor, fontWeight: FontWeight.bold)), ], ), ), ), ), ); }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Widgets/marker_details_cards.dart
import 'package:flutter/material.dart'; import 'button_widgets.dart'; class MarkerDetailsCard { detailsTitle(BuildContext context, String detailsTitle) { return Padding( padding: const EdgeInsets.symmetric(vertical: 2.0), child: Text( detailsTitle, style: TextStyle( color: Theme.of(context).textTheme.subtitle2.color, fontSize: Theme.of(context).textTheme.subtitle2.fontSize, fontWeight: FontWeight.bold), ), ); } detailsName(BuildContext context, String detailsName) { return Padding( padding: const EdgeInsets.symmetric(vertical: 2.0), child: Text( detailsName, style: TextStyle( color: Theme.of(context).textTheme.subtitle2.color, fontSize: Theme.of(context).textTheme.subtitle2.fontSize, fontWeight: FontWeight.normal), ), ); } showSelectLocationDetails(List _trashLocationDetails, context) { String latitude, longitude, name, street, postalCode, administrativeArea, subAdministrativeArea, thoroughfare, subThoroughfare, locality, subLocality, country, isoCountryCode; if (_trashLocationDetails[0] == "") { latitude = "No latitude found"; } else { latitude = _trashLocationDetails[0].toString(); } if (_trashLocationDetails[1] == "") { longitude = "No longitude found"; } else { longitude = _trashLocationDetails[1].toString(); } if (_trashLocationDetails[2] == "") { name = "No name found"; } else { name = _trashLocationDetails[2].toString(); } if (_trashLocationDetails[3] == "") { street = "No street found"; } else { street = _trashLocationDetails[3].toString(); } if (_trashLocationDetails[4] == "") { postalCode = "No postal code found"; } else { postalCode = _trashLocationDetails[4].toString(); } if (_trashLocationDetails[5] == "") { administrativeArea = "No administrative area found"; } else { administrativeArea = _trashLocationDetails[5].toString(); } if (_trashLocationDetails[6] == "") { subAdministrativeArea = "No sub administrative area found"; } else { subAdministrativeArea = _trashLocationDetails[6].toString(); } if (_trashLocationDetails[7] == "") { thoroughfare = "No thoroughfare found"; } else { thoroughfare = _trashLocationDetails[7].toString(); } if (_trashLocationDetails[8] == "") { subThoroughfare = "No sub thoroughfare found"; } else { subThoroughfare = _trashLocationDetails[8].toString(); } if (_trashLocationDetails[9] == "") { locality = "No locality found"; } else { locality = _trashLocationDetails[9].toString(); } if (_trashLocationDetails[10] == "") { subLocality = "No sub locality found"; } else { subLocality = _trashLocationDetails[10].toString(); } if (_trashLocationDetails[11] == "") { country = "No country found"; } else { country = _trashLocationDetails[11].toString(); } if (_trashLocationDetails[12] == "") { isoCountryCode = "No ISO country code found"; } else { isoCountryCode = _trashLocationDetails[12].toString(); } return SingleChildScrollView( child: Container( color: Theme.of(context).appBarTheme.color, child: Center( child: Padding( padding: const EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 14.0, ), Text( "Location Address", style: TextStyle( color: Theme.of(context).textTheme.headline6.color, fontSize: Theme.of(context) .textTheme .headline6 .fontSize, fontWeight: FontWeight.bold), ), ], ), IconButton( icon: Icon(Icons.cancel_rounded), onPressed: () => Navigator.pop(context), ) ], ), SizedBox( height: 10.0, ), detailsTitle(context, "Latitude"), detailsName(context, latitude), SizedBox( height: 5.0, ), detailsTitle(context, "Longitude"), detailsName(context, longitude), SizedBox( height: 5.0, ), detailsTitle(context, "Name"), detailsName(context, name), SizedBox( height: 5.0, ), detailsTitle(context, "Street"), detailsName(context, street), SizedBox( height: 5.0, ), detailsTitle(context, "Postal Code"), detailsName(context, postalCode), SizedBox( height: 5.0, ), detailsTitle(context, "Administrative Area"), detailsName(context, administrativeArea), SizedBox( height: 5.0, ), detailsTitle(context, "Sub Administrative Area"), detailsName(context, subAdministrativeArea), SizedBox( height: 5.0, ), detailsTitle(context, "Thoroughfare"), detailsName(context, thoroughfare), SizedBox( height: 5.0, ), detailsTitle(context, "Sub Thoroughfare"), detailsName(context, subThoroughfare), SizedBox( height: 5.0, ), detailsTitle(context, "Locality"), detailsName(context, locality), SizedBox( height: 5.0, ), detailsTitle(context, "Sub Locality"), detailsName(context, subLocality), SizedBox( height: 5.0, ), detailsTitle(context, "Country"), detailsName(context, country), SizedBox( height: 5.0, ), detailsTitle(context, "ISO Country Code"), detailsName(context, isoCountryCode), SizedBox( height: 80.0, ), ], ), ), ), ), ); } }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Widgets/secondary_app_bar_widget.dart
import 'package:flutter/material.dart'; class SecondaryAppBar extends StatelessWidget implements PreferredSizeWidget { final String title; final AppBar appBar; final List<Widget> widgets; const SecondaryAppBar({Key key, this.title, this.appBar, this.widgets}) : super(key: key); @override Widget build(BuildContext context) { return AppBar( backgroundColor: Theme.of(context).appBarTheme.backgroundColor, leading: IconButton( icon: Icon(Icons.arrow_back_ios_rounded, color: Theme.of(context).iconTheme.color), onPressed: () => Navigator.of(context).pop(), ), title: Text( title, style: Theme.of(context).textTheme.headline6, ), elevation: Theme.of(context).appBarTheme.elevation, actions: widgets, ); } @override Size get preferredSize => new Size.fromHeight(appBar.preferredSize.height); }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Widgets/alert_dialogs.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:trashpick/Pages/OnAppStart/welcome_page.dart'; import 'package:trashpick/Widgets/toast_messages.dart'; class SignOutAlertDialog { void showAlert(BuildContext context) { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: Text('Confirm for Sign Out'), content: Text("Are You Sure Want To Sign Out ?"), actions: <Widget>[ TextButton( child: Text( "NO", style: Theme.of(context).textTheme.button, ), onPressed: () { Navigator.of(context).pop(); print("Cancel Sign Out"); }, ), TextButton( child: Text( "YES", style: Theme.of(context).textTheme.button, ), onPressed: () async { await FirebaseAuth.instance.signOut(); ToastMessages().toastSuccess("Sign Out Success", context); print("Sign Out Success"); Navigator.pushAndRemoveUntil( context, MaterialPageRoute( builder: (BuildContext context) => WelcomePage(), ), (route) => false, ); }, ), ], shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(20.0))), ); }, ); } }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Models/trash_pick_ups_model.dart
import 'package:cloud_firestore/cloud_firestore.dart'; class TrashPickUpsModel { final String trashID; final String postedDate; final String trashName; final String trashDescription; final String trashImage; final List trashTypes; final String trashLocationAddress; final GeoPoint trashLocationLocation; final String startDate; final String returnDate; final String startTime; final String returnTime; TrashPickUpsModel({ this.trashID, this.postedDate, this.trashName, this.trashDescription, this.trashImage, this.trashTypes, this.trashLocationAddress, this.trashLocationLocation, this.startDate, this.returnDate, this.startTime, this.returnTime, }); factory TrashPickUpsModel.fromDocument(DocumentSnapshot documentSnapshot) { return TrashPickUpsModel( trashID: documentSnapshot['trashID'], postedDate: documentSnapshot['postedDate'], trashName: documentSnapshot['trashName'], trashDescription: documentSnapshot['trashDescription'], trashImage: documentSnapshot['trashImage'], trashTypes: documentSnapshot['trashTypes'], trashLocationAddress: documentSnapshot['trashLocationAddress'], trashLocationLocation: documentSnapshot['trashLocationLocation'], startDate: documentSnapshot['startDate'], returnDate: documentSnapshot['returnDate'], startTime: documentSnapshot['startTime'], returnTime: documentSnapshot['returnTime'], ); } }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Models/recycling_center_model.dart
import 'package:cloud_firestore/cloud_firestore.dart'; class RecyclingCenterModel { final String id; final String name; final String address; final String phone; final GeoPoint location; RecyclingCenterModel({ this.id, this.name, this.address, this.phone, this.location, }); factory RecyclingCenterModel.fromDocument(DocumentSnapshot documentSnapshot) { return RecyclingCenterModel( id: documentSnapshot['id'], name: documentSnapshot['name'], address: documentSnapshot['address'], phone: documentSnapshot['phone'], location: documentSnapshot['location'], ); } }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Models/articles_model.dart
import 'package:cloud_firestore/cloud_firestore.dart'; class ArticlesModel { final String articleID; final String articleDescription; final String articleImage; final String articleLink; final String articlePostedDate; final String articleTitle; ArticlesModel({ this.articleID, this.articleDescription, this.articleImage, this.articleLink, this.articlePostedDate, this.articleTitle, }); factory ArticlesModel.fromDocument(DocumentSnapshot documentSnapshot) { return ArticlesModel( articleID: documentSnapshot['articleID'], articleDescription: documentSnapshot['articleDescription'], articleImage: documentSnapshot['articleImage'], articleLink: documentSnapshot['articleLink'], articlePostedDate: documentSnapshot['articlePostedDate'], articleTitle: documentSnapshot['articleTitle'], ); } }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Models/user_model.dart
import 'package:cloud_firestore/cloud_firestore.dart'; class UserModelClass { final String uuid; final String accountType; final String name; final String email; final String contactNumber; final String homeAddress; final GeoPoint appearedLocation; final String lastAppeared; final String accountCreated; final String profileImage; UserModelClass({ this.uuid, this.accountType, this.name, this.email, this.contactNumber, this.homeAddress, this.appearedLocation, this.lastAppeared, this.accountCreated, this.profileImage, }); factory UserModelClass.fromDocument(DocumentSnapshot doc) { return UserModelClass( uuid: doc['uuid'], accountType: doc['accountType'], name: doc['name'], email: doc['email'], contactNumber: doc['contactNumber'], homeAddress: doc['homeAddress'], appearedLocation: doc['appearedLocation'], lastAppeared: doc['lastAppeared'], accountCreated: doc['accountCreated'], profileImage: doc['profileImage'], ); } }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Theme/test_theme.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../Widgets/change_theme_button_widget.dart'; import '../Theme/theme_provider.dart'; class TestTheme extends StatefulWidget { TestTheme({Key key, this.title}) : super(key: key); final String title; @override _TestThemeState createState() => _TestThemeState(); } class _TestThemeState extends State<TestTheme> { @override Widget build(BuildContext context) { final themeText = Provider.of<ThemeProvider>(context).themeMode == ThemeMode.light ? 'Light Theme' : 'Dark Theme'; return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: SingleChildScrollView( child: Center( child: Column( children: [ Container( color: Theme.of(context).accentColor, child: Text( 'Text with a background color', style: Theme.of(context).textTheme.headline6, ), ), ChangeThemeButtonWidget(), Text( "App Theme $themeText", style: Theme.of(context).textTheme.headline5, ), Text( "headline1", style: Theme.of(context).textTheme.headline1, ), Text( "headline2", style: Theme.of(context).textTheme.headline2, ), Text( "headline3", style: Theme.of(context).textTheme.headline3, ), Text( "headline4", style: Theme.of(context).textTheme.headline4, ), Text( "headline5", style: Theme.of(context).textTheme.headline5, ), Text( "headline6", style: Theme.of(context).textTheme.headline6, ), Text( "bodyText1", style: Theme.of(context).textTheme.bodyText1, ), Text( "bodyText2", style: Theme.of(context).textTheme.bodyText2, ), SizedBox( height: 50.0, ), Image.asset( 'assets/logos/trashpick_logo_curved.png', scale: 5.0, ), SizedBox( height: 20.0, ), Image.asset( 'assets/logos/trashpick_logo_round.png', scale: 5.0, ), SizedBox( height: 20.0, ), Image.asset( 'assets/logos/trashpick_logo_square.png', scale: 5.0, ), SizedBox( height: 50.0, ), Text( "PrimaryColor - Green", style: Theme.of(context).textTheme.bodyText2, ), Container( height: 50.0, width: MediaQuery.of(context).size.width, color: Theme.of(context).primaryColor, ), Text( "SecondaryColor", style: Theme.of(context).textTheme.bodyText2, ), Container( height: 50.0, width: MediaQuery.of(context).size.width, color: Theme.of(context).backgroundColor, ), Text( "AccentColor", style: Theme.of(context).textTheme.bodyText2, ), Container( height: 50.0, width: MediaQuery.of(context).size.width, color: Theme.of(context).accentColor, ), Text( "RedColor", style: Theme.of(context).textTheme.bodyText2, ), Container( height: 50.0, width: MediaQuery.of(context).size.width, color: AppThemeData().redColor, ), Text( "BlueColor", style: Theme.of(context).textTheme.bodyText2, ), Container( height: 50.0, width: MediaQuery.of(context).size.width, color: AppThemeData().blueColor, ), Text( "YellowColor", style: Theme.of(context).textTheme.bodyText2, ), Container( height: 50.0, width: MediaQuery.of(context).size.width, color: AppThemeData().yellowColor, ), Text( "WhiteColor", style: Theme.of(context).textTheme.bodyText2, ), Container( height: 50.0, width: MediaQuery.of(context).size.width, color: AppThemeData().whiteColor, ), Text( "GreyColor", style: Theme.of(context).textTheme.bodyText2, ), Container( height: 50.0, width: MediaQuery.of(context).size.width, color: AppThemeData().greyColor, ) ], ), ), ), ); } }
0
mirrored_repositories/trashpick/lib
mirrored_repositories/trashpick/lib/Theme/theme_provider.dart
import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; class ThemeProvider extends ChangeNotifier { ThemeMode themeMode = ThemeMode.system; bool get isDarkMode { if (themeMode == ThemeMode.system) { final brightness = SchedulerBinding.instance.window.platformBrightness; return brightness == Brightness.dark; } else { return themeMode == ThemeMode.dark; } } void toggleTheme(bool isOn) { themeMode = isOn ? ThemeMode.dark : ThemeMode.light; notifyListeners(); } } class AppThemeData { final Color primaryColor = Color.fromRGBO(34, 111, 39, 1); final Color secondaryColor = Colors.grey.shade900; final Color accentColor = Color.fromRGBO(50, 163, 57, 1); final Color redColor = Colors.red; final Color blueColor = Colors.blue; final Color deepBlueColor = Colors.blue.shade800; final Color yellowColor = Colors.yellow; final Color whiteColor = Colors.white; final Color greyColor = Colors.grey; final Color grey200Color = Colors.grey.shade200; static final lightTheme = ThemeData( brightness: Brightness.light, scaffoldBackgroundColor: Colors.white, colorScheme: ColorScheme.light(), primaryColor: Color.fromRGBO(34, 111, 39, 1), backgroundColor: Colors.grey.shade900, accentColor: Color.fromRGBO(50, 163, 57, 1), fontFamily: 'Open Sans', buttonTheme: ButtonThemeData( buttonColor: Colors.grey.shade900, ), appBarTheme: AppBarTheme(color: Colors.white, elevation: 0.0), iconTheme: IconThemeData(color: Colors.grey.shade900), textTheme: TextTheme( headline1: TextStyle(fontSize: 96.0, fontWeight: FontWeight.bold), headline2: TextStyle(fontSize: 60.0, fontWeight: FontWeight.bold), headline3: TextStyle(fontSize: 48.0, fontWeight: FontWeight.bold), headline4: TextStyle(fontSize: 34.0, fontWeight: FontWeight.bold), headline5: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), headline6: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), subtitle1: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), subtitle2: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), bodyText1: TextStyle(fontSize: 14.0, fontWeight: FontWeight.normal), bodyText2: TextStyle(fontSize: 16.0, fontWeight: FontWeight.normal), caption: TextStyle(fontSize: 12.0, fontWeight: FontWeight.normal), overline: TextStyle(fontSize: 10.0, fontWeight: FontWeight.normal), ), ); static final darkTheme = ThemeData( brightness: Brightness.dark, scaffoldBackgroundColor: Colors.grey.shade900, colorScheme: ColorScheme.dark(), primaryColor: Color.fromRGBO(34, 111, 39, 1), backgroundColor: Colors.grey.shade900, accentColor: Color.fromRGBO(50, 163, 57, 1), fontFamily: 'Open Sans', buttonTheme: ButtonThemeData( buttonColor: Colors.grey.shade900, ), appBarTheme: AppBarTheme(color: Colors.grey.shade900, elevation: 0.0), iconTheme: IconThemeData(color: Colors.white), textTheme: TextTheme( headline1: TextStyle(fontSize: 96.0, fontWeight: FontWeight.bold), headline2: TextStyle(fontSize: 60.0, fontWeight: FontWeight.bold), headline3: TextStyle(fontSize: 48.0, fontWeight: FontWeight.bold), headline4: TextStyle(fontSize: 34.0, fontWeight: FontWeight.bold), headline5: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), headline6: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), subtitle1: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), subtitle2: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), bodyText1: TextStyle(fontSize: 14.0, fontWeight: FontWeight.normal), bodyText2: TextStyle(fontSize: 16.0, fontWeight: FontWeight.normal), caption: TextStyle(fontSize: 12.0, fontWeight: FontWeight.normal), overline: TextStyle(fontSize: 10.0, fontWeight: FontWeight.normal), ), ); }
0
mirrored_repositories/trashpick
mirrored_repositories/trashpick/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:trashpick/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/ignite-crud-firebase
mirrored_repositories/ignite-crud-firebase/lib/main.dart
import 'package:flutter/material.dart'; import 'package:firebase_core/firebase_core.dart'; import 'core/app_widget.dart'; void main() { runApp( const FirebaseConfigurationWidget(), ); } class FirebaseConfigurationWidget extends StatelessWidget { const FirebaseConfigurationWidget({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return FutureBuilder( future: Firebase.initializeApp(), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.done) { return const AppWidget(); } if (snapshot.hasError) { return Material( child: Center( child: Text('Error: ${snapshot.error}'), ), ); } return const Material( child: Center( child: CircularProgressIndicator(), ), ); }, ); } }
0
mirrored_repositories/ignite-crud-firebase/lib/shared/widgets
mirrored_repositories/ignite-crud-firebase/lib/shared/widgets/themes/app_text_styles.dart
import 'package:flutter/material.dart'; class AppTextStyles { static const doneItemTextStyle = TextStyle( fontSize: 14, fontWeight: FontWeight.w500, color: Color(0xFF1DB863), decoration: TextDecoration.lineThrough, ); static const undoneItemTextStyle = TextStyle( fontSize: 14, fontWeight: FontWeight.w500, color: Color(0xFF666666), ); }
0
mirrored_repositories/ignite-crud-firebase/lib/shared
mirrored_repositories/ignite-crud-firebase/lib/shared/data/todo_data_source_interface.dart
import 'models/todo_item.dart'; abstract class ToDoDataSourceInterface { Future<void> onAddToDoItem(ToDoItem item); Future<void> onToogleToDoItemState(String uid, bool state); Future<void> onRemoveToDoItem(String uid); Stream<List<ToDoItem>?> fetchToDoListStream(); }
0
mirrored_repositories/ignite-crud-firebase/lib/shared/data
mirrored_repositories/ignite-crud-firebase/lib/shared/data/data_source/todo_remote_data_source.dart
import 'dart:async'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:crud_firebase/shared/data/models/todo_item.dart'; import 'package:crud_firebase/shared/data/todo_data_source_interface.dart'; class ToDoRemoteDataSource implements ToDoDataSourceInterface { final toDoCollection = FirebaseFirestore.instance.collection('toDos'); @override Stream<List<ToDoItem>?> fetchToDoListStream() => toDoCollection.snapshots().map<List<ToDoItem>>( (event) => event.docs.map((doc) => ToDoItem( id: doc.id, title: doc.data()['title'], state: doc.data()['isDone'], )).toList(), ); @override Future<void> onAddToDoItem(ToDoItem item) async { await toDoCollection.add( { 'title': item.title, 'isDone': item.state, }, ); } @override Future<void> onRemoveToDoItem(String uid) async { await toDoCollection.doc(uid).delete(); } @override Future<void> onToogleToDoItemState(String uid, bool state) async { await toDoCollection.doc(uid).update({'isDone': state}); } }
0
mirrored_repositories/ignite-crud-firebase/lib/shared/data
mirrored_repositories/ignite-crud-firebase/lib/shared/data/models/todo_item.dart
class ToDoItem { ToDoItem({ required this.id, required this.title, this.state = false, }); final String id; final String title; final bool state; }
0
mirrored_repositories/ignite-crud-firebase/lib/modules
mirrored_repositories/ignite-crud-firebase/lib/modules/home/home_page.dart
import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:uuid/uuid.dart'; import 'store/home_page_store.dart'; import 'widget/task_input_field.dart'; import 'package:crud_firebase/shared/data/models/todo_item.dart'; import 'package:crud_firebase/shared/widgets/themes/app_text_styles.dart'; class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { final _store = HomePageStore(); final _toDoItemTitleEditingController = TextEditingController(); @override void dispose() { _toDoItemTitleEditingController.dispose(); super.dispose(); } String undoneTaskQuantityMessage(int listLength) { final messageBodyPluralConcordance = listLength > 1 ? 'tarefas' : 'tarefa'; final messageBody = listLength != 0 ? listLength.toString() : 'nenhuma'; return '$messageBody $messageBodyPluralConcordance'; } @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( resizeToAvoidBottomInset: false, appBar: PreferredSize( preferredSize: const Size.fromHeight(177), child: Container( height: 177, color: const Color(0xFF8257E5), padding: const EdgeInsets.symmetric(horizontal: 24), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Observer( builder: (_) => Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Flexible( child: Image.asset( 'assets/images/logo.png', height: 20, ), ), Flexible( child: Text.rich( TextSpan( text: 'Você tem ', style: const TextStyle( fontSize: 15, fontWeight: FontWeight.w400, color: Colors.white, ), children: [ TextSpan( text: undoneTaskQuantityMessage( _store.undoneTaskListLength, ), style: const TextStyle( fontSize: 15, fontWeight: FontWeight.w700, color: Colors.white, ), ), ], ), ), ), ], ), ), TaskInputField( controller: _toDoItemTitleEditingController, onTap: () { _store.addItem( ToDoItem( id: const Uuid().v4(), title: _toDoItemTitleEditingController.value.text, ), ); _toDoItemTitleEditingController.clear(); }, ), ], ), ), ), body: Observer( builder: (_) => ToDoItemListView( itemList: _store.itemList, onDeleteItem: _store.deleteItem, toogleItemState: _store.toogleItemState, ), ), ), ); } } class ToDoItemListView extends StatelessWidget { const ToDoItemListView({ Key? key, required this.itemList, required this.onDeleteItem, required this.toogleItemState, }) : super(key: key); final ValueChanged<ToDoItem> onDeleteItem; final ValueChanged<ToDoItem> toogleItemState; final List<ToDoItem> itemList; @override Widget build(BuildContext context) { return ListView.builder( itemCount: itemList.length, itemBuilder: (_, index) { final item = itemList[index]; return Container( decoration: BoxDecoration( gradient: index.isEven ? const LinearGradient( colors: [ Color(0xFFC4C4C4), Color(0xFFFFFFFF), ], ) : const LinearGradient( colors: [ Color(0xFFFFFFFF), Color(0xFFFFFFFF), ], ), ), child: CheckboxListTile( controlAffinity: ListTileControlAffinity.leading, title: Text( item.title, style: item.state == true ? AppTextStyles.doneItemTextStyle : AppTextStyles.undoneItemTextStyle, ), secondary: SizedBox( width: 80, child: GestureDetector( onTap: () => onDeleteItem(item), child: Image.asset( 'assets/images/delete.png', height: 24, ), ), ), activeColor: Colors.green, value: item.state, onChanged: (_) => toogleItemState(item), ), ); }, ); } }
0
mirrored_repositories/ignite-crud-firebase/lib/modules/home
mirrored_repositories/ignite-crud-firebase/lib/modules/home/widget/task_input_field.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; class TaskInputField extends StatelessWidget { const TaskInputField({ Key? key, required this.controller, required this.onTap, }) : super(key: key); final TextEditingController controller; final VoidCallback onTap; @override Widget build(BuildContext context) { return Container( height: 56, decoration: BoxDecoration( color: Colors.white, border: Border.all( width: 1, color: const Color(0xFFEBEBEB), ), borderRadius: const BorderRadius.all( Radius.circular(5.0), ), ), child: ListTile( title: TextField( controller: controller, textAlignVertical: TextAlignVertical.center, decoration: InputDecoration( border: InputBorder.none, floatingLabelBehavior: FloatingLabelBehavior.never, isCollapsed: true, contentPadding: EdgeInsets.zero, labelText: 'Adicione uma tarefa', labelStyle: GoogleFonts.inter( fontSize: 14, color: const Color(0xFFB2B2B2), fontWeight: FontWeight.w400, ), ), ), trailing: GestureDetector( onTap: onTap, child: Container( height: 56, padding: const EdgeInsets.only(left: 16), decoration: const BoxDecoration( border: Border( left: BorderSide( width: 1.0, color: Color(0xFFEBEBEB), ), ), ), child: const Icon( Icons.keyboard_arrow_right, color: Color(0xFFB2B2B2), ), ), ), ), ); } }
0
mirrored_repositories/ignite-crud-firebase/lib/modules/home
mirrored_repositories/ignite-crud-firebase/lib/modules/home/store/home_page_store.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'home_page_store.dart'; // ************************************************************************** // StoreGenerator // ************************************************************************** // ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic mixin _$HomePageStore on _HomePageStore, Store { Computed<List<ToDoItem>>? _$itemListComputed; @override List<ToDoItem> get itemList => (_$itemListComputed ??= Computed<List<ToDoItem>>(() => super.itemList, name: '_HomePageStore.itemList')) .value; Computed<int>? _$undoneTaskListLengthComputed; @override int get undoneTaskListLength => (_$undoneTaskListLengthComputed ??= Computed<int>(() => super.undoneTaskListLength, name: '_HomePageStore.undoneTaskListLength')) .value; final _$toDoListStreamAtom = Atom(name: '_HomePageStore.toDoListStream'); @override ObservableStream<List<ToDoItem>?> get toDoListStream { _$toDoListStreamAtom.reportRead(); return super.toDoListStream; } @override set toDoListStream(ObservableStream<List<ToDoItem>?> value) { _$toDoListStreamAtom.reportWrite(value, super.toDoListStream, () { super.toDoListStream = value; }); } @override String toString() { return ''' toDoListStream: ${toDoListStream}, itemList: ${itemList}, undoneTaskListLength: ${undoneTaskListLength} '''; } }
0
mirrored_repositories/ignite-crud-firebase/lib/modules/home
mirrored_repositories/ignite-crud-firebase/lib/modules/home/store/home_page_store.dart
import 'package:mobx/mobx.dart'; import 'package:crud_firebase/shared/data/data_source/todo_remote_data_source.dart'; import 'package:crud_firebase/shared/data/models/todo_item.dart'; import 'package:crud_firebase/shared/data/todo_data_source_interface.dart'; part 'home_page_store.g.dart'; class HomePageStore = _HomePageStore with _$HomePageStore; abstract class _HomePageStore with Store { static final ToDoDataSourceInterface _toDoRemoteDS = ToDoRemoteDataSource(); @observable var toDoListStream = _toDoRemoteDS.fetchToDoListStream().asObservable(); Future<void> toogleItemState(ToDoItem oldItem) async { await _toDoRemoteDS.onToogleToDoItemState(oldItem.id, !oldItem.state); } Future<void> addItem(ToDoItem item) async { await _toDoRemoteDS.onAddToDoItem(item); } Future<void> deleteItem(ToDoItem item) async { await _toDoRemoteDS.onRemoveToDoItem(item.id); } @computed List<ToDoItem> get itemList { final sortedItemList = toDoListStream.value ?..sort((a, b) => a.state ? 1 : -1); return sortedItemList ?? <ToDoItem>[]; } @computed int get undoneTaskListLength => itemList.where((item) => item.state == false).length; }
0
mirrored_repositories/ignite-crud-firebase/lib/modules
mirrored_repositories/ignite-crud-firebase/lib/modules/splash/splash_page.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:crud_firebase/modules/home/home_page.dart'; class SplashPage extends StatefulWidget { const SplashPage({Key? key}) : super(key: key); @override _SplashPageState createState() => _SplashPageState(); } class _SplashPageState extends State<SplashPage> { @override void initState() { super.initState(); WidgetsBinding.instance?.addPostFrameCallback( (_) async { await Future.delayed( const Duration(seconds: 2), ); if (mounted) { Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => const HomePage(), ), ); } }, ); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFF8257E5), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( alignment: Alignment.center, height: 44, width: 160, child: Image.asset('assets/images/logo.png'), ), Padding( padding: const EdgeInsets.only(top: 40), child: Text( 'Seu aplicativo favorito de afarezes', textAlign: TextAlign.center, style: GoogleFonts.inter( fontSize: 18, color: Colors.white, ), ), ), ], ), ), ); } }
0
mirrored_repositories/ignite-crud-firebase/lib
mirrored_repositories/ignite-crud-firebase/lib/core/app_widget.dart
import 'package:flutter/material.dart'; import 'package:crud_firebase/modules/splash/splash_page.dart'; class AppWidget extends StatelessWidget { const AppWidget({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( title: 'Ignite Flutter | Firebase\'s CRUD Challenge', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.purple, checkboxTheme: Theme.of(context).checkboxTheme.copyWith( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(4), ), side: const BorderSide( width: 1.5, color: Color(0xFFB2B2B2), ), ), ), home: const SplashPage(), ); } }
0
mirrored_repositories/Trackify
mirrored_repositories/Trackify/lib/main.dart
import 'package:flutter/material.dart'; import 'package:trackify/widgets/expenses.dart'; var kColorScheme = ColorScheme.fromSeed( seedColor: const Color.fromARGB(255, 96, 59, 181), ); var kDarkColorScheme = ColorScheme.fromSeed( brightness: Brightness.dark, seedColor: const Color.fromARGB(255, 5, 99, 125), ); void main() { runApp( MaterialApp( darkTheme: ThemeData.dark().copyWith( useMaterial3: true, colorScheme: kDarkColorScheme, cardTheme: const CardTheme().copyWith( color: kDarkColorScheme.secondaryContainer, margin: const EdgeInsets.symmetric( horizontal: 16, vertical: 8, ), ), elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( backgroundColor: kDarkColorScheme.primaryContainer, foregroundColor: kDarkColorScheme.onPrimaryContainer, ), ), ), // DarkTheme theme: ThemeData().copyWith( useMaterial3: true, colorScheme: kColorScheme, appBarTheme: const AppBarTheme().copyWith( backgroundColor: kColorScheme.onPrimaryContainer, foregroundColor: kColorScheme.primaryContainer, ), cardTheme: const CardTheme().copyWith( color: kColorScheme.secondaryContainer, margin: const EdgeInsets.symmetric( horizontal: 16, vertical: 8, ), ), elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( backgroundColor: kColorScheme.primaryContainer, ), ), textTheme: ThemeData().textTheme.copyWith( titleLarge: TextStyle( fontWeight: FontWeight.bold, color: kColorScheme.onSecondaryContainer, fontSize: 16, ), ), ), home: const Expenses(), ), ); }
0
mirrored_repositories/Trackify/lib
mirrored_repositories/Trackify/lib/widgets/new_expense.dart
import 'package:flutter/material.dart'; import 'package:trackify/models/expense.dart'; class NewExpense extends StatefulWidget { const NewExpense({ super.key, required this.onAddExpense, }); final void Function(Expense expense) onAddExpense; @override State<NewExpense> createState() { return _NewExpenseState(); } } class _NewExpenseState extends State<NewExpense> { final _titleController = TextEditingController(); final _amountController = TextEditingController(); DateTime? _selectedDate; Category _selectedCategory = Category.leisure; void _presentDatePicker() async { final now = DateTime.now(); final firstDate = DateTime(now.year - 1, now.month, now.day); final pickedDate = await showDatePicker( context: context, initialDate: now, firstDate: firstDate, lastDate: now, ); setState(() { _selectedDate = pickedDate; }); } void _showDialog() { showDialog( context: context, builder: (ctx) => AlertDialog( title: const Text( 'Invalid Input', ), content: const Text( 'Please make sure a valid title, amount, date and category was entered.', ), actions: [ TextButton( onPressed: () { Navigator.pop(ctx); }, child: const Text( 'Okay', ), ), ], ), ); } void _submitExpenseData() { final enteredAmount = double.tryParse(_amountController.text); final amountIsInvalid = enteredAmount == null || enteredAmount <= 0; if (_titleController.text.trim().isEmpty || amountIsInvalid || _selectedDate == null) { _showDialog(); return; } widget.onAddExpense( Expense( title: _titleController.text, amount: enteredAmount, date: _selectedDate!, category: _selectedCategory, ), ); Navigator.pop(context); } @override void dispose() { _titleController.dispose(); _amountController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { final keyboardSpace = MediaQuery.of(context).viewInsets.bottom; return LayoutBuilder( builder: (ctx, constraints) { final width = constraints.maxWidth; return SizedBox( height: double.infinity, child: SingleChildScrollView( child: Padding( padding: EdgeInsets.fromLTRB(16, 16, 16, keyboardSpace + 16), child: Column( children: [ if (width >= 600) Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: TextField( controller: _titleController, maxLength: 30, decoration: const InputDecoration( label: Text('Title'), ), ), ), const SizedBox( width: 24, ), Expanded( child: TextField( controller: _amountController, keyboardType: TextInputType.number, decoration: const InputDecoration( prefixText: '\u{20B9} ', label: Text('Amount'), ), ), ), ], ) else TextField( controller: _titleController, maxLength: 30, decoration: const InputDecoration( label: Text('Title'), ), ), if (width >= 600) Row( children: [ DropdownButton( value: _selectedCategory, items: Category.values .map( (category) => DropdownMenuItem( value: category, child: Text( category.name.toUpperCase(), ), ), ) .toList(), onChanged: (value) { if (value == null) { return; } setState(() { _selectedCategory = value; }); }, ), const SizedBox( width: 24, ), Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( _selectedDate == null ? 'No Date Selected' : formatter.format(_selectedDate!), ), IconButton( onPressed: _presentDatePicker, icon: const Icon( Icons.calendar_month, ), ), ], ), ), ], ) else Row( children: [ Expanded( child: TextField( controller: _amountController, keyboardType: TextInputType.number, decoration: const InputDecoration( prefixText: '\u{20B9} ', label: Text('Amount'), ), ), ), const SizedBox( width: 16, ), Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( _selectedDate == null ? 'No Date Selected' : formatter.format(_selectedDate!), ), IconButton( onPressed: _presentDatePicker, icon: const Icon( Icons.calendar_month, ), ), ], ), ), ], ), const SizedBox( height: 16, ), if (width >= 600) Row( children: [ const Spacer(), TextButton( onPressed: () { Navigator.pop(context); }, child: const Text('Cancel'), ), ElevatedButton( onPressed: _submitExpenseData, child: const Text( 'Save Expense', ), ), ], ) else Row( children: [ DropdownButton( value: _selectedCategory, items: Category.values .map( (category) => DropdownMenuItem( value: category, child: Text( category.name.toUpperCase(), ), ), ) .toList(), onChanged: (value) { if (value == null) { return; } setState(() { _selectedCategory = value; }); }, ), const Spacer(), TextButton( onPressed: () { Navigator.pop(context); }, child: const Text('Cancel'), ), ElevatedButton( onPressed: _submitExpenseData, child: const Text( 'Save Expense', ), ), ], ), ], ), ), ), ); }, ); } }
0
mirrored_repositories/Trackify/lib
mirrored_repositories/Trackify/lib/widgets/expenses.dart
import 'package:flutter/material.dart'; import 'package:trackify/widgets/chart/chart.dart'; import 'package:trackify/widgets/expenses_list/expenses_list.dart'; import 'package:trackify/widgets/new_expense.dart'; import '../models/expense.dart'; class Expenses extends StatefulWidget { const Expenses({super.key}); @override State<Expenses> createState() { return _ExpensesState(); } } class _ExpensesState extends State<Expenses> { final List<Expense> _registeredExpenses = [ Expense( title: 'Flutter Course', amount: 1350, date: DateTime.now(), category: Category.work, ), Expense( title: 'Cinema', amount: 150, date: DateTime.now(), category: Category.leisure, ), ]; void _openAddExpenseOverlay() { showModalBottomSheet( useSafeArea: true, isScrollControlled: true, context: context, builder: (ctx) => NewExpense( onAddExpense: _addExpense, ), ); } void _addExpense(Expense expense) { setState(() { _registeredExpenses.add(expense); }); } void _removeExpense(Expense expense) { final expenseIndex = _registeredExpenses.indexOf(expense); setState(() { _registeredExpenses.remove(expense); }); ScaffoldMessenger.of(context).clearSnackBars(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( duration: const Duration( seconds: 3, ), content: const Text( 'Expense Deleted', ), action: SnackBarAction( label: 'Undo', onPressed: () { setState(() { _registeredExpenses.insert( expenseIndex, expense, ); }); }, ), ), ); } @override Widget build(BuildContext context) { final width = MediaQuery.of(context).size.width; Widget mainContent = const Center( child: Text( 'No expenses found. Start adding some!', ), ); if (_registeredExpenses.isNotEmpty) { mainContent = ExpensesList( expenses: _registeredExpenses, onRemoveExpense: _removeExpense, ); } return Scaffold( appBar: AppBar( title: const Text( 'Trackify', ), actions: [ IconButton( onPressed: _openAddExpenseOverlay, icon: const Icon( Icons.add, ), ), ], ), body: width < 600 ? Column( children: [ Chart( expenses: _registeredExpenses, ), Expanded( child: mainContent, ), ], ) : Row( children: [ Expanded( child: Chart( expenses: _registeredExpenses, ), ), Expanded( child: mainContent, ), ], ), ); } }
0
mirrored_repositories/Trackify/lib/widgets
mirrored_repositories/Trackify/lib/widgets/expenses_list/expense_item.dart
import 'package:flutter/material.dart'; import 'package:trackify/models/expense.dart'; class ExpenseItem extends StatelessWidget { const ExpenseItem(this.expense, {super.key}); final Expense expense; @override Widget build(BuildContext context) { return Card( child: Padding( padding: const EdgeInsets.symmetric( horizontal: 20, vertical: 16, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( expense.title, style: Theme.of(context).textTheme.titleLarge, ), const SizedBox( height: 4, ), Row( children: [ Text( '\u{20B9}${expense.amount.toStringAsFixed(2)}', ), const Spacer(), Row( children: [ Icon( categoryIcons[expense.category], ), const SizedBox( width: 8, ), Text( expense.formattedDate, ), ], ), ], ), ], ), ), ); } }
0
mirrored_repositories/Trackify/lib/widgets
mirrored_repositories/Trackify/lib/widgets/expenses_list/expenses_list.dart
import 'package:flutter/material.dart'; import 'package:trackify/widgets/expenses_list/expense_item.dart'; import '../../models/expense.dart'; class ExpensesList extends StatelessWidget { const ExpensesList({ super.key, required this.expenses, required this.onRemoveExpense, }); final List<Expense> expenses; final void Function(Expense expense) onRemoveExpense; @override Widget build(BuildContext context) { return ListView.builder( itemCount: expenses.length, itemBuilder: (ctx, index) => Dismissible( key: ValueKey( expenses[index], ), background: Container( color: Theme.of(context).colorScheme.error, margin: EdgeInsets.symmetric( horizontal: Theme.of(context).cardTheme.margin!.horizontal, ), ), onDismissed: (direction) { onRemoveExpense(expenses[index]); }, child: ExpenseItem( expenses[index], ), ), ); } }
0
mirrored_repositories/Trackify/lib/widgets
mirrored_repositories/Trackify/lib/widgets/chart/chart.dart
import 'package:flutter/material.dart'; import 'package:trackify/widgets/chart/chart_bar.dart'; import 'package:trackify/models/expense.dart'; class Chart extends StatelessWidget { const Chart({super.key, required this.expenses}); final List<Expense> expenses; List<ExpenseBucket> get buckets { return [ ExpenseBucket.forCategory(expenses, Category.food), ExpenseBucket.forCategory(expenses, Category.leisure), ExpenseBucket.forCategory(expenses, Category.travel), ExpenseBucket.forCategory(expenses, Category.work), ]; } double get maxTotalExpense { double maxTotalExpense = 0; for (final bucket in buckets) { if (bucket.totalExpenses > maxTotalExpense) { maxTotalExpense = bucket.totalExpenses; } } return maxTotalExpense; } @override Widget build(BuildContext context) { final isDarkMode = MediaQuery.of(context).platformBrightness == Brightness.dark; return Container( margin: const EdgeInsets.all(16), padding: const EdgeInsets.symmetric( vertical: 16, horizontal: 8, ), width: double.infinity, height: 180, decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), gradient: LinearGradient( colors: [ Theme.of(context).colorScheme.primary.withOpacity(0.3), Theme.of(context).colorScheme.primary.withOpacity(0.0) ], begin: Alignment.bottomCenter, end: Alignment.topCenter, ), ), child: Column( children: [ Expanded( child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ for (final bucket in buckets) // alternative to map() ChartBar( fill: bucket.totalExpenses == 0 ? 0 : bucket.totalExpenses / maxTotalExpense, ) ], ), ), const SizedBox(height: 12), Row( children: buckets .map( (bucket) => Expanded( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 4), child: Icon( categoryIcons[bucket.category], color: isDarkMode ? Theme.of(context).colorScheme.secondary : Theme.of(context) .colorScheme .primary .withOpacity(0.7), ), ), ), ) .toList(), ), ], ), ); } }
0
mirrored_repositories/Trackify/lib/widgets
mirrored_repositories/Trackify/lib/widgets/chart/chart_bar.dart
import 'package:flutter/material.dart'; class ChartBar extends StatelessWidget { const ChartBar({ super.key, required this.fill, }); final double fill; @override Widget build(BuildContext context) { final isDarkMode = MediaQuery.of(context).platformBrightness == Brightness.dark; return Expanded( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 4), child: FractionallySizedBox( heightFactor: fill, child: DecoratedBox( decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: const BorderRadius.vertical(top: Radius.circular(8)), color: isDarkMode ? Theme.of(context).colorScheme.secondary : Theme.of(context).colorScheme.primary.withOpacity(0.65), ), ), ), ), ); } }
0
mirrored_repositories/Trackify/lib
mirrored_repositories/Trackify/lib/models/expense.dart
import 'package:flutter/material.dart'; import 'package:uuid/uuid.dart'; import 'package:intl/intl.dart'; final formatter = DateFormat.yMd(); const uuid = Uuid(); enum Category { food, travel, leisure, work } const categoryIcons = { Category.food: Icons.lunch_dining, Category.travel: Icons.flight_takeoff, Category.leisure: Icons.movie, Category.work: Icons.work, }; class Expense { Expense( {required this.title, required this.amount, required this.date, required this.category}) : id = uuid.v4(); final String id; final String title; final double amount; final DateTime date; final Category category; String get formattedDate { return formatter.format(date); } } class ExpenseBucket { const ExpenseBucket({ required this.category, required this.expenses, }); ExpenseBucket.forCategory( List<Expense> allExpenses, this.category, ) : expenses = allExpenses .where((expense) => expense.category == category) .toList(); final Category category; final List<Expense> expenses; double get totalExpenses { double sum = 0; for (final expense in expenses) { sum += expense.amount; } return sum; } }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/task.dart
import 'package:flutter/material.dart'; import 'package:flutter_todolist/appBars.dart'; import 'package:flutter_todolist/bottomNavigation.dart'; import 'package:flutter_todolist/fab.dart'; import 'package:flutter_todolist/util.dart'; class Task extends StatefulWidget { Task({Key key}) : super(key: key); _TaskState createState() => _TaskState(); } class _TaskState extends State<Task> { final bottomNavigationBarIndex = 1; @override Widget build(BuildContext context) { return Scaffold( appBar: fullAppbar(context), body: Container( padding: EdgeInsets.symmetric(horizontal: 10), width: MediaQuery.of(context).size.width, child: CustomScrollView( slivers: <Widget>[ SliverList( delegate: SliverChildBuilderDelegate( (BuildContext context, int index) => Container( margin: EdgeInsets.only(left: 10, top: 15, bottom: 0), child: Text( 'Projects', style: TextStyle( fontSize: 13, fontWeight: FontWeight.w600, color: CustomColors.TextSubHeader), ), ), childCount: 1), ), SliverGrid.count( crossAxisCount: 2, children: [ Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( width: 65, height: 65, child: Image.asset('assets/images/icon-user.png'), decoration: const BoxDecoration( color: CustomColors.YellowBackground, borderRadius: BorderRadius.all( Radius.circular(50.0), ), ), ), SizedBox(height: 5), Text( 'Personal', style: TextStyle( fontSize: 17, color: CustomColors.TextHeaderGrey, fontWeight: FontWeight.w600), ), SizedBox(height: 8), Text( '24 Tasks', style: TextStyle( fontSize: 9, color: CustomColors.TextSubHeaderGrey), ), ], ), ), decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], color: Colors.white, ), margin: EdgeInsets.all(10), height: 150.0), Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( width: 65, height: 65, child: Image.asset('assets/images/icon-briefcase.png'), decoration: const BoxDecoration( color: CustomColors.GreenBackground, borderRadius: BorderRadius.all( Radius.circular(50.0), ), ), ), SizedBox(height: 5), Text( 'Work', style: TextStyle( fontSize: 17, color: CustomColors.TextHeaderGrey, fontWeight: FontWeight.w600), ), SizedBox(height: 8), Text( '44 Tasks', style: TextStyle( fontSize: 9, color: CustomColors.TextSubHeaderGrey), ), ], ), ), decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], color: Colors.white, ), margin: EdgeInsets.all(10), height: 150.0), Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( width: 65, height: 65, child: Image.asset('assets/images/icon-presentation.png'), decoration: const BoxDecoration( color: CustomColors.PurpleBackground, borderRadius: BorderRadius.all( Radius.circular(50.0), ), ), ), SizedBox(height: 5), Text( 'Meeting', style: TextStyle( fontSize: 17, color: CustomColors.TextHeaderGrey, fontWeight: FontWeight.w600), ), SizedBox(height: 8), Text( '45 Tasks', style: TextStyle( fontSize: 9, color: CustomColors.TextSubHeaderGrey), ), ], ), ), decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], color: Colors.white, ), margin: EdgeInsets.all(10), height: 150.0), Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( width: 65, height: 65, child: Image.asset('assets/images/icon-shopping-basket.png'), decoration: const BoxDecoration( color: CustomColors.OrangeBackground, borderRadius: BorderRadius.all( Radius.circular(50.0), ), ), ), SizedBox(height: 5), Text( 'Shopping', style: TextStyle( fontSize: 17, color: CustomColors.TextHeaderGrey, fontWeight: FontWeight.w600), ), SizedBox(height: 8), Text( '54 Tasks', style: TextStyle( fontSize: 9, color: CustomColors.TextSubHeaderGrey), ), ], ), ), decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], color: Colors.white, ), margin: EdgeInsets.all(10), height: 150.0), Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( width: 65, height: 65, child: Image.asset('assets/images/icon-confetti.png'), decoration: const BoxDecoration( color: CustomColors.BlueBackground, borderRadius: BorderRadius.all( Radius.circular(50.0), ), ), ), SizedBox(height: 5), Text( 'Party', style: TextStyle( fontSize: 17, color: CustomColors.TextHeaderGrey, fontWeight: FontWeight.w600), ), SizedBox(height: 8), Text( '24 Tasks', style: TextStyle( fontSize: 9, color: CustomColors.TextSubHeaderGrey), ), ], ), ), decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], color: Colors.white, ), margin: EdgeInsets.all(10), height: 150.0), Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Container( width: 65, height: 65, child: Image.asset('assets/images/icon-molecule.png'), decoration: const BoxDecoration( color: CustomColors.PurpleBackground, borderRadius: BorderRadius.all( Radius.circular(50.0), ), ), ), SizedBox(height: 5), Text( 'Study', style: TextStyle( fontSize: 17, color: CustomColors.TextHeaderGrey, fontWeight: FontWeight.w600), ), SizedBox(height: 8), Text( '24 Tasks', style: TextStyle( fontSize: 9, color: CustomColors.TextSubHeaderGrey), ), ], ), ), decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], color: Colors.white, ), margin: EdgeInsets.all(10), height: 150.0), ], ), ], ), ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButton: customFab(context), bottomNavigationBar: BottomNavigationBarApp(context, bottomNavigationBarIndex), ); } }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/onboarding.dart
import 'package:flutter/material.dart'; import 'util.dart'; import 'package:flutter_todolist/empty.dart'; class Onboarding extends StatefulWidget { Onboarding({Key key}) : super(key: key); _OnboardingState createState() => _OnboardingState(); } class _OnboardingState extends State<Onboarding> { @override void initState() { super.initState(); } @override void dispose() { super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( width: MediaQuery.of(context).size.width / 1.2, child: Column( children: <Widget>[ Expanded( flex: 8, child: Hero( tag: 'Clipboard', child: Image.asset('assets/images/Clipboard.png'), ), ), Expanded( flex: 3, child: Column( children: <Widget>[ Text( 'Reminders made simple', style: TextStyle( fontSize: 22, fontWeight: FontWeight.w500, color: CustomColors.TextHeader), ), SizedBox(height: 15), Text( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris pellentesque erat in blandit luctus.', style: TextStyle( fontSize: 17, fontWeight: FontWeight.w400, color: CustomColors.TextBody, fontFamily: 'opensans'), textAlign: TextAlign.center, ), ], ), ), Expanded( flex: 1, child: RaisedButton( onPressed: () { // HERO-ANIMATION: https://github.com/flutter/flutter/issues/28041 // Navigator.of(context).pushReplacement( // PageRouteBuilder( // transitionDuration: Duration(seconds: 1), // pageBuilder: (_, __, ___) => Empty(), // ), // ); Navigator.pushReplacement( context, MaterialPageRoute(builder: (context) => Empty()), ); }, textColor: Colors.white, padding: const EdgeInsets.all(0.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), ), child: Container( width: MediaQuery.of(context).size.width / 1.4, height: 60, decoration: const BoxDecoration( gradient: LinearGradient( colors: <Color>[ CustomColors.GreenLight, CustomColors.GreenDark, ], ), borderRadius: BorderRadius.all( Radius.circular(8.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreenShadow, blurRadius: 15.0, spreadRadius: 7.0, offset: Offset(0.0, 0.0), ), ], ), padding: const EdgeInsets.fromLTRB(20, 10, 20, 10), child: Center( child: const Text( 'Get Started', style: TextStyle( fontSize: 18, fontWeight: FontWeight.w500), ), ), ), ), ), Expanded( flex: 1, child: Container(), ) ], ), ), ), ); } }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/appBars.dart
import 'package:flutter/material.dart'; import 'package:gradient_app_bar/gradient_app_bar.dart'; import 'util.dart'; Widget fullAppbar(BuildContext context) { return PreferredSize( preferredSize: Size.fromHeight(210.0), child: GradientAppBar( flexibleSpace: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ CustomPaint( painter: CircleOne(), ), CustomPaint( painter: CircleTwo(), ), ], ), title: Container( margin: EdgeInsets.only(top: 20), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Hello Brenda!', style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600), ), Text( 'Today you have 9 tasks', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w300), ), ], ), ), actions: <Widget>[ Container( margin: EdgeInsets.fromLTRB(0, 20, 20, 0), child: Image.asset('assets/images/photo.png'), ), ], elevation: 0, gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [CustomColors.HeaderBlueDark, CustomColors.HeaderBlueLight], ), bottom: PreferredSize( preferredSize: Size.fromHeight(10), child: Container( margin: EdgeInsets.symmetric(vertical: 15, horizontal: 20), padding: EdgeInsets.fromLTRB(15, 5, 15, 0), decoration: BoxDecoration( color: CustomColors.HeaderGreyLight, borderRadius: BorderRadius.circular(5.0), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Today Reminder', style: TextStyle( color: Colors.white, fontSize: 17, fontWeight: FontWeight.w600), ), SizedBox( height: 3, ), Text( 'Meeting with client', style: TextStyle( color: Colors.white, fontSize: 10, fontWeight: FontWeight.w300), ), SizedBox( height: 3, ), Text( '13.00 PM', style: TextStyle( color: Colors.white, fontSize: 10, fontWeight: FontWeight.w300), ), ], ), Container( width: MediaQuery.of(context).size.width / 2.9, ), Image.asset( 'assets/images/bell-left.png', scale: 1.3, ), Container( margin: EdgeInsets.only(bottom: 80), child: Icon( Icons.clear, color: Colors.white, size: 18.0, ), ), ], ), ), ), ), ); } Widget emptyAppbar() { return PreferredSize( preferredSize: Size.fromHeight(75.0), child: GradientAppBar( flexibleSpace: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ CustomPaint( painter: CircleOne(), ), CustomPaint( painter: CircleTwo(), ), ], ), title: Container( margin: EdgeInsets.only(top: 20), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Text( 'Hello Brenda!', style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600), ), Text( 'Today you have no tasks', style: TextStyle(fontSize: 10, fontWeight: FontWeight.w300), ), ], ), ), actions: <Widget>[ Container( margin: EdgeInsets.fromLTRB(0, 20, 20, 0), child: Image.asset('assets/images/photo.png'), ), ], elevation: 0, gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [CustomColors.HeaderBlueDark, CustomColors.HeaderBlueLight], ), ), ); } class CircleOne extends CustomPainter { Paint _paint; CircleOne() { _paint = Paint() ..color = CustomColors.HeaderCircle ..strokeWidth = 10.0 ..style = PaintingStyle.fill; } @override void paint(Canvas canvas, Size size) { canvas.drawCircle(Offset(28.0, 0.0), 99.0, _paint); } @override bool shouldRepaint(CustomPainter oldDelegate) { return false; } } class CircleTwo extends CustomPainter { Paint _paint; CircleTwo() { _paint = Paint() ..color = CustomColors.HeaderCircle ..strokeWidth = 10.0 ..style = PaintingStyle.fill; } @override void paint(Canvas canvas, Size size) { canvas.drawCircle(Offset(-30, 20), 50.0, _paint); } @override bool shouldRepaint(CustomPainter oldDelegate) { return false; } }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/util.dart
import 'package:flutter/material.dart'; class CustomColors { static const Color GreyBackground = Color.fromRGBO(249, 252, 255, 1); static const Color GreyBorder = Color.fromRGBO(207, 207, 207, 1); static const Color GreenLight = Color.fromRGBO(93, 230, 26, 1); static const Color GreenDark = Color.fromRGBO(57, 170, 2, 1); static const Color GreenIcon = Color.fromRGBO(30, 209, 2, 1); static const Color GreenAccent = Color.fromRGBO(30, 209, 2, 1); static const Color GreenShadow = Color.fromRGBO(30, 209, 2, 0.24); // 24% static const Color GreenBackground = Color.fromRGBO(181, 255, 155, 0.36); // 36% static const Color OrangeIcon = Color.fromRGBO(236, 108, 11, 1); static const Color OrangeBackground = Color.fromRGBO(255, 208, 155, 0.36); // 36% static const Color PurpleLight = Color.fromRGBO(248, 87, 195, 1); static const Color PurpleDark = Color.fromRGBO(224, 19, 156, 1); static const Color PurpleIcon = Color.fromRGBO(209, 2, 99, 1); static const Color PurpleAccent = Color.fromRGBO(209, 2, 99, 1); static const Color PurpleShadow = Color.fromRGBO(209, 2, 99, 0.27); // 27% static const Color PurpleBackground = Color.fromRGBO(255, 155, 205, 0.36); // 36% static const Color DeeppurlpleIcon = Color.fromRGBO(191, 0, 128, 1); static const Color DeeppurlpleBackground = Color.fromRGBO(245, 155, 255, 0.36); // 36% static const Color BlueLight = Color.fromRGBO(126, 182, 255, 1); static const Color BlueDark = Color.fromRGBO(95, 135, 231, 1); static const Color BlueIcon = Color.fromRGBO(9, 172, 206, 1); static const Color BlueBackground = Color.fromRGBO(155, 255, 248, 0.36); // 36% static const Color BlueShadow = Color.fromRGBO(104, 148, 238, 1); static const Color HeaderBlueLight = Color.fromRGBO(129, 199, 245, 1); static const Color HeaderBlueDark = Color.fromRGBO(56, 103, 213, 1); static const Color HeaderGreyLight = Color.fromRGBO(225, 255, 255, 0.31); // 31% static const Color YellowIcon = Color.fromRGBO(249, 194, 41, 1); static const Color YellowBell = Color.fromRGBO(225, 220, 0, 1); static const Color YellowAccent = Color.fromRGBO(255, 213, 6, 1); static const Color YellowShadow = Color.fromRGBO(243, 230, 37, 0.27); // 27% static const Color YellowBackground = Color.fromRGBO(255, 238, 155, 0.36); // 36% static const Color BellGrey = Color.fromRGBO(217, 217, 217, 1); static const Color BellYellow = Color.fromRGBO(255, 220, 0, 1); static const Color TrashRed = Color.fromRGBO(251, 54, 54, 1); static const Color TrashRedBackground = Color.fromRGBO(255, 207, 207, 1); static const Color TextHeader = Color.fromRGBO(85, 78, 143, 1); static const Color TextHeaderGrey = Color.fromRGBO(104, 104, 104, 1); static const Color TextSubHeaderGrey = Color.fromRGBO(161, 161, 161, 1); static const Color TextSubHeader = Color.fromRGBO(139, 135, 179, 1); static const Color TextBody = Color.fromRGBO(130, 160, 183, 1); static const Color TextGrey = Color.fromRGBO(198, 198, 200, 1); static const Color TextWhite = Color.fromRGBO(243, 243, 243, 1); static const Color HeaderCircle = Color.fromRGBO(255, 255, 255, 0.17); }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/bottomNavigation.dart
import 'package:flutter/material.dart'; import 'package:flutter_todolist/home.dart'; import 'package:flutter_todolist/task.dart'; import 'util.dart'; class BottomNavigationBarApp extends StatelessWidget { final int bottomNavigationBarIndex; final BuildContext context; const BottomNavigationBarApp(this.context, this.bottomNavigationBarIndex); void onTabTapped(int index) { Navigator.of(context).push( MaterialPageRoute<Null>(builder: (BuildContext context) { return (index == 1) ? Task() : Home(); }), ); } @override Widget build(BuildContext context) { return BottomNavigationBar( currentIndex: bottomNavigationBarIndex, type: BottomNavigationBarType.fixed, selectedFontSize: 10, selectedLabelStyle: TextStyle(color: CustomColors.BlueDark), selectedItemColor: CustomColors.BlueDark, unselectedFontSize: 10, items: [ BottomNavigationBarItem( icon: Container( margin: EdgeInsets.only(bottom: 5), child: Image.asset( 'assets/images/home.png', color: (bottomNavigationBarIndex == 0) ? CustomColors.BlueDark : CustomColors.TextGrey, ), ), label: 'Home', ), BottomNavigationBarItem( icon: Container( margin: EdgeInsets.only(bottom: 5), child: Image.asset( 'assets/images/task.png', color: (bottomNavigationBarIndex == 1) ? CustomColors.BlueDark : CustomColors.TextGrey, ), ), label: 'Task', ), ], onTap: onTabTapped, ); } }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/bottomSheet.dart
import 'package:flutter/material.dart'; import 'package:flutter_todolist/home.dart'; import 'util.dart'; class Modal { mainBottomSheet(BuildContext context) { showModalBottomSheet( context: context, backgroundColor: Colors.transparent, isScrollControlled: true, builder: (BuildContext context) { return Container( height: MediaQuery.of(context).size.height - 80, padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), child: Stack( alignment: AlignmentDirectional.topCenter, children: <Widget>[ Positioned( top: MediaQuery.of(context).size.height / 25, left: 0, child: Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.vertical( top: Radius.elliptical(175, 30), ), ), ), ), Positioned( top: MediaQuery.of(context).size.height / 2 - 340, child: Container( child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ InkWell( onTap: () { Navigator.pop(context); }, child: Container( width: 50, height: 50, child: Image.asset('assets/images/fab-delete.png'), decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: <Color>[ CustomColors.PurpleLight, CustomColors.PurpleDark, ], ), borderRadius: BorderRadius.all( Radius.circular(50.0), ), boxShadow: [ BoxShadow( color: CustomColors.PurpleShadow, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), ), Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ SizedBox(height: 10), Text( 'Add new task', style: TextStyle( fontSize: 13, fontWeight: FontWeight.w600), ), SizedBox(height: 10), Container( width: MediaQuery.of(context).size.width / 1.2, child: TextFormField( initialValue: 'Book a table for dinner ', autofocus: true, style: TextStyle( fontSize: 22, fontStyle: FontStyle.normal), decoration: InputDecoration(border: InputBorder.none), ), ), SizedBox(height: 5), Container( width: MediaQuery.of(context).size.width / 1.2, height: 60, padding: EdgeInsets.symmetric(vertical: 15), decoration: BoxDecoration( border: Border( top: BorderSide( width: 1.0, color: CustomColors.GreyBorder, ), bottom: BorderSide( width: 1.0, color: CustomColors.GreyBorder, ), ), ), child: ListView( scrollDirection: Axis.horizontal, shrinkWrap: true, children: <Widget>[ Center( child: Row( children: <Widget>[ Container( height: 10.0, width: 10.0, margin: EdgeInsets.only(right: 4), decoration: BoxDecoration( color: CustomColors.YellowAccent, shape: BoxShape.circle, ), ), Container( margin: EdgeInsets.only(right: 10), child: Text('Personal'), ), ], ), ), Center( child: Container( margin: EdgeInsets.only(right: 10), child: Text( 'Work', style: TextStyle(color: Colors.white), ), padding: EdgeInsets.symmetric( vertical: 5, horizontal: 10), decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(5), ), color: CustomColors.GreenIcon, boxShadow: [ BoxShadow( color: CustomColors.GreenShadow, blurRadius: 5.0, spreadRadius: 3.0, offset: Offset(0.0, 0.0), ), ], ), ), ), Center( child: Row( children: <Widget>[ Container( height: 10.0, width: 10.0, margin: EdgeInsets.only(right: 4), decoration: BoxDecoration( color: CustomColors.PurpleIcon, shape: BoxShape.circle, ), ), Container( margin: EdgeInsets.only(right: 10), child: Text('Meeting'), ), ], ), ), Center( child: Row( children: <Widget>[ Container( height: 10.0, width: 10.0, margin: EdgeInsets.only(right: 4), decoration: BoxDecoration( color: CustomColors.BlueIcon, shape: BoxShape.circle, ), ), Container( margin: EdgeInsets.only(right: 10), child: Text('Study'), ), ], ), ), Center( child: Row( children: <Widget>[ Container( height: 10.0, width: 10.0, margin: EdgeInsets.only(right: 4), decoration: BoxDecoration( color: CustomColors.OrangeIcon, shape: BoxShape.circle, ), ), Container( margin: EdgeInsets.only(right: 10), child: Text('Shopping'), ), ], ), ), ], ), ), SizedBox(height: 20), Container( width: MediaQuery.of(context).size.width / 1.2, child: Text( 'Choose date', textAlign: TextAlign.left, style: TextStyle(fontSize: 12), ), ), SizedBox(height: 10), Container( width: MediaQuery.of(context).size.width / 1.2, child: Row( children: <Widget>[ Text( 'Today, 19: - 21:00', textAlign: TextAlign.left, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600), ), SizedBox(width: 5), RotatedBox( quarterTurns: 1, child: Icon(Icons.chevron_right), ), ], ), ), SizedBox(height: 20), RaisedButton( onPressed: () { Navigator.pushReplacement( context, MaterialPageRoute(builder: (context) => Home()), ); // Navigator.pop(context); }, textColor: Colors.white, padding: const EdgeInsets.all(0.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), ), child: Container( width: MediaQuery.of(context).size.width / 1.2, height: 60, decoration: const BoxDecoration( gradient: LinearGradient( colors: <Color>[ CustomColors.BlueLight, CustomColors.BlueDark, ], ), borderRadius: BorderRadius.all( Radius.circular(8.0), ), boxShadow: [ BoxShadow( color: CustomColors.BlueShadow, blurRadius: 2.0, spreadRadius: 1.0, offset: Offset(0.0, 0.0), ), ], ), padding: const EdgeInsets.fromLTRB(20, 10, 20, 10), child: Center( child: const Text( 'Add task', style: TextStyle( fontSize: 18, fontWeight: FontWeight.w500), ), ), ), ), SizedBox(height: 20), ], ), ], ), ), ), ], ), ); }, ); } }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_todolist/onboarding.dart'; import 'util.dart'; void main() => runApp(App()); class App extends StatefulWidget { App({Key key}) : super(key: key); _AppState createState() => _AppState(); } class _AppState extends State<App> { @override void initState() { SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle( statusBarColor: Colors.transparent, //top bar color ), ); // SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]); super.initState(); } @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( canvasColor: CustomColors.GreyBackground, fontFamily: 'rubik', ), home: Onboarding(), ); } }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/empty.dart
import 'package:flutter/material.dart'; import 'package:flutter_todolist/appBars.dart'; import 'package:flutter_todolist/bottomNavigation.dart'; import 'package:flutter_todolist/fab.dart'; import 'util.dart'; class Empty extends StatefulWidget { Empty({Key key}) : super(key: key); _EmptyState createState() => _EmptyState(); } class _EmptyState extends State<Empty> { var bottomNavigationBarIndex = 0; @override Widget build(BuildContext context) { return Scaffold( appBar: emptyAppbar(), body: Center( child: Container( width: MediaQuery.of(context).size.width / 1.2, child: Column( children: <Widget>[ Expanded( flex: 8, child: Hero( tag: 'Clipboard', child: Image.asset('assets/images/Clipboard-empty.png'), ), ), Expanded( flex: 3, child: Column( children: <Widget>[ Text( 'No tasks', style: TextStyle( fontSize: 22, fontWeight: FontWeight.w500, color: CustomColors.TextHeader), ), SizedBox(height: 15), Text( 'You have no tasks to do.', style: TextStyle( fontSize: 17, fontWeight: FontWeight.w400, color: CustomColors.TextBody, fontFamily: 'opensans'), textAlign: TextAlign.center, ), ], ), ), Expanded( flex: 1, child: Container(), ) ], ), ), ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButton: customFab(context), bottomNavigationBar: BottomNavigationBarApp(context, bottomNavigationBarIndex), ); } }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/home.dart
import 'package:flutter/material.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_todolist/appBars.dart'; import 'package:flutter_todolist/bottomNavigation.dart'; import 'package:flutter_todolist/fab.dart'; import 'package:flutter_todolist/util.dart'; class Home extends StatefulWidget { Home({Key key}) : super(key: key); _HomeState createState() => _HomeState(); } class _HomeState extends State<Home> { final bottomNavigationBarIndex = 0; @override Widget build(BuildContext context) { return Scaffold( appBar: fullAppbar(context), body: Container( width: MediaQuery.of(context).size.width, child: ListView( scrollDirection: Axis.vertical, children: <Widget>[ Container( margin: EdgeInsets.only(top: 15, left: 20, bottom: 15), child: Text( 'Today', style: TextStyle( fontSize: 13, fontWeight: FontWeight.w600, color: CustomColors.TextSubHeader), ), ), Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked.png'), Text( '07.00 AM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Go jogging with Christin', style: TextStyle( color: CustomColors.TextGrey, //fontWeight: FontWeight.w600, decoration: TextDecoration.lineThrough), ), ), Image.asset('assets/images/bell-small.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.YellowIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), Slidable( actionPane: SlidableDrawerActionPane(), actionExtentRatio: 0.25, child: Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked-empty.png'), Text( '08.00 AM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Send project file', style: TextStyle( color: CustomColors.TextHeader, fontWeight: FontWeight.w600), ), ), Image.asset('assets/images/bell-small.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.GreenIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), secondaryActions: <Widget>[ SlideAction( child: Container( padding: EdgeInsets.only(bottom: 10), child: Container( height: 35, width: 35, decoration: BoxDecoration( borderRadius: BorderRadius.circular(50), color: CustomColors.TrashRedBackground), child: Image.asset('assets/images/trash.png'), ), ), onTap: () => print('Delete'), ), ], ), Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked-empty.png'), Text( '10.00 AM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Meeting with client', style: TextStyle( color: CustomColors.TextHeader, fontWeight: FontWeight.w600), ), ), Image.asset('assets/images/bell-small-yellow.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.PurpleIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked-empty.png'), Text( '13.00 PM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Email client', style: TextStyle( color: CustomColors.TextHeader, fontWeight: FontWeight.w600), ), ), Image.asset('assets/images/bell-small.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.GreenIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), Container( margin: EdgeInsets.only(left: 20, bottom: 15), child: Text( 'Tomorrow', style: TextStyle( fontSize: 13, fontWeight: FontWeight.w600, color: CustomColors.TextSubHeader), ), ), Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked-empty.png'), Text( '07.00 AM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Morning yoga', style: TextStyle( color: CustomColors.TextHeader, fontWeight: FontWeight.w600), ), ), Image.asset('assets/images/bell-small.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.YellowIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked-empty.png'), Text( '08.00 AM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Sending project file', style: TextStyle( color: CustomColors.TextHeader, fontWeight: FontWeight.w600), ), ), Image.asset('assets/images/bell-small.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.GreenIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked-empty.png'), Text( '10.00 AM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Meeting with client', style: TextStyle( color: CustomColors.TextHeader, fontWeight: FontWeight.w600), ), ), Image.asset('assets/images/bell-small-yellow.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.PurpleIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked-empty.png'), Text( '13.00 PM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Email client', style: TextStyle( color: CustomColors.TextHeader, fontWeight: FontWeight.w600), ), ), Image.asset('assets/images/bell-small.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.GreenIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked-empty.png'), Text( '13.00 PM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Meeting with client', style: TextStyle( color: CustomColors.TextHeader, fontWeight: FontWeight.w600), ), ), Image.asset('assets/images/bell-small-yellow.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.PurpleIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), Container( margin: EdgeInsets.fromLTRB(20, 0, 20, 15), padding: EdgeInsets.fromLTRB(5, 13, 5, 13), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ Image.asset('assets/images/checked-empty.png'), Text( '13.00 PM', style: TextStyle(color: CustomColors.TextGrey), ), Container( width: 180, child: Text( 'Email client', style: TextStyle( color: CustomColors.TextHeader, fontWeight: FontWeight.w600), ), ), Image.asset('assets/images/bell-small.png'), ], ), decoration: BoxDecoration( gradient: LinearGradient( stops: [0.015, 0.015], colors: [CustomColors.GreenIcon, Colors.white], ), borderRadius: BorderRadius.all( Radius.circular(5.0), ), boxShadow: [ BoxShadow( color: CustomColors.GreyBorder, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), SizedBox(height: 15) ], ), ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButton: customFab(context), bottomNavigationBar: BottomNavigationBarApp(context, bottomNavigationBarIndex), ); } }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/lib/fab.dart
import 'package:flutter/material.dart'; import 'package:flutter_todolist/bottomSheet.dart'; import 'util.dart'; FloatingActionButton customFab(context) { Modal modal = Modal(); return FloatingActionButton( onPressed: () { modal.mainBottomSheet(context); }, elevation: 5, backgroundColor: Colors.transparent, child: Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, child: Image.asset('assets/images/fab-add.png'), decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: <Color>[ CustomColors.PurpleLight, CustomColors.PurpleDark, ], ), borderRadius: BorderRadius.all( Radius.circular(50.0), ), boxShadow: [ BoxShadow( color: CustomColors.PurpleShadow, blurRadius: 10.0, spreadRadius: 5.0, offset: Offset(0.0, 0.0), ), ], ), ), ); }
0
mirrored_repositories/flutter_todolist
mirrored_repositories/flutter_todolist/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_todolist/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(App()); // 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/Voice_Prescription
mirrored_repositories/Voice_Prescription/lib/main.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:voiceprescriptionfe/screens/registration.dart'; import 'package:voiceprescriptionfe/screens/sign_up.dart'; import 'package:voiceprescriptionfe/screens/login.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( initialRoute: Registration.id, routes: { Registration.id: (context) => Registration(), SignUp.id: (context) => SignUp(), Login.id: (context) => Login(), }, home: Registration(), ); } }
0
mirrored_repositories/Voice_Prescription/lib
mirrored_repositories/Voice_Prescription/lib/screens/registration.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:voiceprescriptionfe/screens/sign_up.dart'; import 'package:voiceprescriptionfe/screens/login.dart'; class Registration extends StatelessWidget { static String id = 'registrationscreen'; @override Widget build(BuildContext context) { return Scaffold( body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('images/3568983.png'), fit: BoxFit.fitWidth, alignment: Alignment.bottomCenter, ), ), child: Padding( padding: EdgeInsets.only(top: 160), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ CustomRaisedButton( text: 'Log In', id: '', ), SizedBox( height: 30, ), CustomRaisedButton( text: 'Sign Up', id: SignUp.id, ), ], ), )), ); } } class CustomRaisedButton extends StatelessWidget { CustomRaisedButton({@required this.text, @required this.id}); final String text; final String id; @override Widget build(BuildContext context) { return ButtonTheme( minWidth: 150, height: 45, child: RaisedButton( elevation: 8.0, color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), onPressed: () { Navigator.pushNamed(context, id); }, child: Text( text, style: TextStyle( color: Color.fromRGBO(27, 55, 100, 1), fontSize: 20, fontWeight: FontWeight.w400, ), ), ), ); } }
0
mirrored_repositories/Voice_Prescription/lib
mirrored_repositories/Voice_Prescription/lib/screens/sign_up.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class SignUp extends StatelessWidget { static String id = 'signupscreen'; @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: SafeArea( child: Container( width: double.infinity, height: MediaQuery.of(context).size.height, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('images/Bg_SignUp.png'), fit: BoxFit.fill, ), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ SignupCards( image: Image.asset('images/Doctor_DP.png'), text: 'SignUp as Doctor', ), SignupCards( image: Image.asset('images/Patient_DP.png'), text: 'SignUp as Patient', ), ], ), ), ), ), ); } } class SignupCards extends StatelessWidget { SignupCards({this.image, this.text}); final Image image; final String text; @override Widget build(BuildContext context) { return Container( padding: EdgeInsets.symmetric(vertical: 40, horizontal: 70), child: Column( children: <Widget>[ Column( children: <Widget>[ Container( child: Column( children: <Widget>[ image, SizedBox( height: 10, ), Text( text, style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), ], ), height: 170, width: double.infinity, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(30), border: Border.all( color: Color.fromRGBO(27, 55, 100, 1), width: 1.2, ), boxShadow: <BoxShadow>[ BoxShadow( color: Color.fromRGBO(27, 55, 100, 1), offset: Offset(0, 0.95), ), ], ), ), ], ), RoundIcon(), ], ), ); } } class RoundIcon extends StatelessWidget { @override Widget build(BuildContext context) { return CircleAvatar( radius: 30, child: Icon( Icons.check, color: Color.fromRGBO(27, 55, 100, 1), ), ); } }
0
mirrored_repositories/Voice_Prescription
mirrored_repositories/Voice_Prescription/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:voiceprescriptionfe/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/To_do_App
mirrored_repositories/To_do_App/lib/main.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'package:todo_app/provider/tasks_data_provider.dart'; import 'home_page/ToDo_App.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { SystemChrome.setSystemUIOverlayStyle( const SystemUiOverlayStyle( statusBarColor: Colors.transparent, ), ); return ChangeNotifierProvider( create: (context) => Tasks_Data_Provider(), child: const MaterialApp( home: ToDo_App(), debugShowCheckedModeBanner: false, ), ); } }
0
mirrored_repositories/To_do_App/lib
mirrored_repositories/To_do_App/lib/app_pages/friends_page.dart
import 'package:flutter/material.dart'; class FriendsPage extends StatelessWidget { const FriendsPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("friends"), centerTitle: true, backgroundColor: Colors.deepOrangeAccent, ), ); } }
0
mirrored_repositories/To_do_App/lib
mirrored_repositories/To_do_App/lib/home_page/ToDo_App.dart
import 'package:flutter/material.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:todo_app/drawer_widget/navigation_drawer.dart'; import 'package:todo_app/provider/tasks_data_provider.dart'; class ToDo_App extends StatefulWidget { const ToDo_App({Key? key}) : super(key: key); @override State<ToDo_App> createState() => _ToDo_AppState(); } class _ToDo_AppState extends State<ToDo_App> { int slidervalue1 = 50; int slidervalue2 = 50; final TextEditingController _taskcateogry = TextEditingController(); final TextEditingController _taskdescription = TextEditingController(); final TextEditingController _taskdate = TextEditingController(); final provider = Tasks_Data_Provider(); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.grey[300], drawer: const NavigationDrawer(), appBar: AppBar( backgroundColor: Colors.grey[300], elevation: 0, iconTheme: IconThemeData(color: Colors.deepOrange[800]), actions: [ IconButton( iconSize: 28, onPressed: () {}, icon: Icon( Icons.search_rounded, color: Colors.deepOrange[900], ), ), IconButton( iconSize: 28, onPressed: () {}, icon: Icon( Icons.notifications_none, color: Colors.deepOrange[800], ), ), ], ), floatingActionButton: FloatingActionButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), elevation: 4, onPressed: () { showDialog( context: context, barrierDismissible: true, builder: (context) => AlertDialog( backgroundColor: Colors.orange[100], title: const Center( child: Text( 'add your task ', style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold), )), titlePadding: const EdgeInsets.fromLTRB(4, 5, 4, 10), content: SizedBox( height: 250, child: Column( children: [ TextFormField( controller: _taskcateogry, decoration: InputDecoration( labelStyle: TextStyle( color: Colors.deepOrange[300], fontWeight: FontWeight.bold), border: const UnderlineInputBorder(), labelText: "task cateogry", ), style: const TextStyle( fontWeight: FontWeight.normal, fontSize: 15), ), const SizedBox(height: 10), TextFormField( controller: _taskdescription, decoration: InputDecoration( labelStyle: TextStyle( color: Colors.deepOrange[300], fontWeight: FontWeight.bold), border: const UnderlineInputBorder(), labelText: "task description"), style: const TextStyle( fontWeight: FontWeight.normal, fontSize: 15), ), TextFormField( controller: _taskdate, decoration: InputDecoration( labelStyle: TextStyle( color: Colors.deepOrange[300], fontWeight: FontWeight.bold), border: const UnderlineInputBorder(), labelText: "task date"), style: const TextStyle( fontWeight: FontWeight.normal, fontSize: 15), ), const SizedBox(height: 10), SizedBox( height: 45, width: double.infinity, child: ElevatedButton( onPressed: () { Tasks_Data_Provider().addtask( _taskdescription.text, _taskcateogry.text, _taskdate.text); Navigator.pop(context); final snackBar = SnackBar( content: const Text( 'Task saved successfully', style: TextStyle( fontWeight: FontWeight.bold), ), action: SnackBarAction( label: 'undo', onPressed: () {})); ScaffoldMessenger.of(context) .showSnackBar(snackBar); }, style: ButtonStyle( backgroundColor: MaterialStateProperty.all(Colors.black)), child: const Text( "save", style: TextStyle(fontWeight: FontWeight.bold), )), ) ], ), ))); }, tooltip: "add task", backgroundColor: Colors.deepOrange.shade300, child: const Icon( Icons.add, ), ), //---------------------------------------------- body: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Row( children: [ const SizedBox(width: 20), const Text( "What's up,", style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 30, fontStyle: FontStyle.normal), ), Text( " Ahmed!", style: TextStyle( color: Colors.deepOrange[300], fontWeight: FontWeight.bold, fontSize: 30, fontStyle: FontStyle.normal), ), ], ), const SizedBox( height: 30, ), Row( children: [ const SizedBox( width: 20, ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(1.5), color: Colors.white), child: Text( "CATEGORIES", style: TextStyle( color: Colors.grey[600], fontSize: 13, fontWeight: FontWeight.bold), ), ), ], ), const SizedBox(height: 20), Row( children: [ const SizedBox(width: 20), Container( decoration: BoxDecoration( color: Colors.grey[100], borderRadius: BorderRadius.circular(20)), width: 170, height: 100, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "5 tasks", style: TextStyle( color: Colors.grey[600], fontWeight: FontWeight.bold), ), const Text( "business", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 20), ), const SizedBox(height: 20), ClipRRect( borderRadius: BorderRadius.circular((20)), child: SizedBox( height: 3, width: 100, child: Row( children: [ Expanded( child: Container( color: Colors.grey[900], height: 3, width: 100, ), // flex: (percentagedone ?? 1), ), Expanded( // flex: 100 - (percentage ?? 1), child: Container( color: Colors.grey[900], height: 3, width: 100, ), ), ], ), ), ), ], ), ), const SizedBox(width: 10), Container( decoration: BoxDecoration( color: Colors.grey[100], borderRadius: BorderRadius.circular(20)), width: 170, height: 100, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "10 tasks", style: TextStyle( color: Colors.grey[600], fontWeight: FontWeight.bold), ), const Text( "personal", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 20), ), const SizedBox(height: 20), ClipRRect( borderRadius: BorderRadius.circular((20)), child: SizedBox( height: 3, width: 100, child: Row( children: [ Expanded( child: Container( color: Colors.orange[500], height: 9, width: 100, ), // flex: (percentagedone ?? 1), ), Expanded( // flex: 100 - (percentage ?? 1), child: Container( color: Colors.orange[500], height: 3, width: 100, ), ), ], ), ), ), ], ), ), ], ), const SizedBox(height: 20), Row( children: [ const SizedBox(width: 20), Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(1.5), color: Colors.white), child: Text("TODAY'S TASKS", style: TextStyle( color: Colors.grey[600], fontWeight: FontWeight.bold, fontSize: 13, )), ), ], ), //---------------------------------------------- const SizedBox(height: 10), Expanded( child: ListView.builder( physics: const BouncingScrollPhysics(), itemCount: provider.tasks.length, itemBuilder: (context, index) { final task = provider.tasks[index]; return Slidable( key: Key(provider.tasks[index].name), endActionPane: ActionPane( motion: const StretchMotion(), dismissible: DismissiblePane(onDismissed: () {}), children: [ SlidableAction( onPressed: (index) {}, backgroundColor: Colors.black87, foregroundColor: Colors.white, label: 'edit', icon: Icons.edit_sharp), SlidableAction( onPressed: (index) {}, backgroundColor: Colors.red, foregroundColor: Colors.white, label: 'delete', icon: Icons.delete, ), ]), child: buildListTile(task), ); }), ), ], ), ); } Widget buildListTile(task task) => ListTile( contentPadding: const EdgeInsets.all(12), leading: IconButton( onPressed: () {}, icon: Icon( Icons.circle_outlined, color: task.taskcategory == 'business' ? Colors.grey[900] : Colors.deepOrangeAccent, ), ), onTap: () {}, title: Text( task.name, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16), ), subtitle: Text( task.taskdate.toString(), style: TextStyle( color: Colors.grey[800], fontSize: 13, fontWeight: FontWeight.bold), ), trailing: IconButton( iconSize: 20, onPressed: () { if (task.isfavourit == true) { task.isfavourit == false; provider.chnageiconcolor(task); } else { final snackBar = SnackBar( content: const Text( 'Task added to favourits successfully', style: TextStyle(fontWeight: FontWeight.bold), ), action: SnackBarAction( label: 'undo', onPressed: () { task.isfavourit = false; provider.chnageiconcolor(task); })); ScaffoldMessenger.of(context).showSnackBar(snackBar); setState(() { task.isfavourit = true; provider.chnageiconcolor(task); }); } }, icon: task.isfavourit == true ? const Icon( Icons.favorite, color: Colors.deepOrangeAccent, ) : const Icon(Icons.favorite_outline_outlined)), ); }
0
mirrored_repositories/To_do_App/lib
mirrored_repositories/To_do_App/lib/data_base/app_data_base.dart
import 'package:sqflite/sqflite.dart'; import 'Data_modules.dart'; import 'package:todo_app/provider/tasks_data_provider.dart'; final Provider = Tasks_Data_Provider(); class LocalDatabase { static late Database database; static List<Tasks_Data> data = []; static Future<void> createDatabase() async { database = await openDatabase('test1.db', version: 1, onCreate: (database, version) async { print('database is created!'); await database .execute( 'create table tasks_data (id integer primary key autoincrement, task_name text ,taskcateogry text , isfinished bool , createdtime DateTime , favouritTasks text)' 'create table user_data (id integer primary key, name text , email text , age int )') .then((value) => print("tables are created !")); }).catchError((error) { print(error.toString()); }); } //_____________________________________________________________________ static Future<void> insertintoDatabase(Tasks_Data data) async { database .rawInsert( 'insert into tasks_data (name,taskcateogry,createdtime,isfinished) values (?,?,?,?)', [data.name, data.taskcategory, data.createdtime, data.isfinished]) .then((value) => print('${value} is inserted successfully ')) .catchError((error) { print(error.toString()); }); } //_____________________________________________________________________ static void getData(Database database) { database .rawQuery('select * from tasks_data' 'select * from user_data ') .then((value) => value.forEach((element) { data.add(Tasks_Data( createdtime: element['createdtime'] as DateTime, taskcategory: element['taskcateogry'] as String, name: element['name'] as String)); })) .catchError((error) { print(error.toString()); }); } //______________________________________________________________________ static void updateDatabase(Tasks_Data data) { database .rawUpdate( 'update tasks_data set taskcateogry = ? , isfinished = ? , name = ? where id = ?', [data.taskcategory, data.isfinished, data.name, data.id]) .then((value) => print('record $value is updates successfully')) .catchError((error) { print(error.toString()); }); } //_______________________________________________________________________ static void deleteDatabase(int id) { database .rawDelete('delete from tasks_data where id = ?', [id]) .then((value) => print('record $value is deleted successfully')) .catchError((error) { print(error.toString()); }); } // addnewtask(task newtask ) async { // final db = await database; // db.insert('tasks', , conflictAlgorithm: ConflictAlgorithm.replace); // } }
0
mirrored_repositories/To_do_App/lib
mirrored_repositories/To_do_App/lib/data_base/Data_modules.dart
class Tasks_Data { DateTime createdtime; String taskcategory; String name; bool isfinished; int id; bool isfavourit; Tasks_Data({ required this.createdtime, required this.taskcategory, required this.name, this.isfinished = false, this.id = 0, this.isfavourit = false, }); }
0
mirrored_repositories/To_do_App/lib
mirrored_repositories/To_do_App/lib/provider/tasks_data_provider.dart
import 'package:flutter/material.dart'; class Tasks_Data_Provider extends ChangeNotifier { final List<task> tasks = [ task( createdtime: DateTime.now(), taskcategory: "business", name: "daily meeting with my team", id: 1, taskdate: 'Apr 18, 2022', isfavourit: true), task( createdtime: DateTime.now(), taskcategory: "personal", name: "launch with my fiance", id: 2, taskdate: 'Apr 17, 2022', isfavourit: true), task( createdtime: DateTime.now(), taskcategory: "personal", name: "meditation", id: 3, taskdate: 'Apr 5, 2022', isfavourit: false), task( createdtime: DateTime.now(), taskcategory: "business", name: "sending 1 million dollars to Tesla", id: 4, taskdate: 'Apr 28, 2022', isfavourit: false), task( createdtime: DateTime.now(), taskcategory: "business", name: "gettin the deal with Ubisoft Inc", id: 5, taskdate: 'MAY 20, 2022', isfavourit: true), task( createdtime: DateTime.now(), taskcategory: "personal", name: "reading Atomic habits book", id: 6, taskdate: 'MAY 16, 2022', isfavourit: true), ]; void addtask(String newtask, String newtaskcategory, String date) { final _task = task( createdtime: DateTime.now(), taskcategory: newtaskcategory, name: newtask, id: 8, //keep tracking of the last id entered and (++) to add a new id to the new task taskdate: date, isfinished: false, //getting the taskdate entered by the userin that fucking format! ); notifyListeners(); } updatetask(task task) {} deletetask(task task) { tasks.remove(task); notifyListeners(); } void chnageiconcolor(task task) { if (task.isfavourit == true) { const Icon(Icons.favorite, color: Colors.deepOrangeAccent); } else if (task.isfavourit == false) { const Icon(Icons.favorite_outline_outlined); } } } class task { DateTime createdtime; String taskcategory; String name; bool isfinished; int id; String taskdate; bool isfavourit; task({ required this.createdtime, required this.taskcategory, required this.name, this.isfinished = false, this.id = 0, required this.taskdate, this.isfavourit = false, }); void togglefavourit() { isfavourit = !isfavourit; } }
0
mirrored_repositories/To_do_App/lib
mirrored_repositories/To_do_App/lib/drawer_widget/navigation_drawer.dart
import 'package:flutter/material.dart'; import 'package:todo_app/drawer_widget/drawer_item.dart'; import 'package:todo_app/app_pages/friends_page.dart'; class NavigationDrawer extends StatelessWidget { const NavigationDrawer({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Drawer( child: Material( color: Colors.grey[800], child: Padding( padding: const EdgeInsets.fromLTRB(24, 80, 24, 0), child: Column( children: [ headerWidget(), const SizedBox( height: 40, ), Divider( thickness: 1, height: 10, color: Colors.grey[850], ), const SizedBox( height: 20, ), DrawerItem( name: "friends", icon: Icons.people, onpressed: () => onItemPressed(context, index: 0)), const SizedBox( height: 10, ), DrawerItem( name: "templates", icon: Icons.bookmark_border_outlined, onpressed: () => onItemPressed(context, index: 1)), const SizedBox( height: 10, ), DrawerItem( name: "favourits", icon: Icons.favorite_outline, onpressed: () => onItemPressed(context, index: 4)), const SizedBox( height: 10, ), DrawerItem( name: "analytics", icon: Icons.analytics, onpressed: () => onItemPressed(context, index: 3)), const SizedBox( height: 10, ), DrawerItem( name: "settings", icon: Icons.settings, onpressed: () => onItemPressed(context, index: 4)), ], ), ), ), ); } void onItemPressed(BuildContext context, {required int index}) { Navigator.pop(context); switch (index) { case 0: Navigator.push(context, MaterialPageRoute(builder: (context) => const FriendsPage())); } } Widget headerWidget() => Row( children: [ CircleAvatar( backgroundColor: Colors.grey[700], radius: 40, backgroundImage: const AssetImage('assets/ahmedosama.png'), ), const SizedBox(width: 20), Column( crossAxisAlignment: CrossAxisAlignment.start, children: const [ Text("Ahmed Osama", style: TextStyle( fontSize: 20, color: Colors.white, fontWeight: FontWeight.bold)), SizedBox(height: 20), Text('jrahmedosama@gmail.com', style: TextStyle( fontSize: 12.6, color: Colors.white, fontWeight: FontWeight.bold)), ], ) ], ); }
0
mirrored_repositories/To_do_App/lib
mirrored_repositories/To_do_App/lib/drawer_widget/drawer_item.dart
import 'package:flutter/material.dart'; class DrawerItem extends StatelessWidget { const DrawerItem({Key? key, required this.name, required this.icon, required this.onpressed}) : super(key: key); final String name; final IconData icon; final Function() onpressed; @override Widget build(BuildContext context) { return InkWell( onTap: onpressed, child: SizedBox( height: 40, child: Row( children: [ Icon(icon,size: 20, color: Colors.white), const SizedBox(width: 40), Text(name,style: const TextStyle(fontSize: 20,fontWeight: FontWeight.bold,color: Colors.white),), ], ), ), ); } }
0
mirrored_repositories/WORKLIST
mirrored_repositories/WORKLIST/lib/main.dart
import 'package:flutter/material.dart'; import 'package:truedo/screens/homescreen.dart'; void main() => runApp(TruedoApp()); class TruedoApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp(title: 'WORK LIST', home: new HomeScreen()); } }
0
mirrored_repositories/WORKLIST
mirrored_repositories/WORKLIST/lib/database.dart
import 'dart:io'; import 'package:path/path.dart'; import 'package:path_provider/path_provider.dart'; import 'package:sqflite/sqflite.dart'; class DBProvider{ DBProvider._(); static final DBProvider db = DBProvider._(); static Database _database; Future<Database> get database async{ if(_database != null) return _database; _database = await initDB(); return _database; } initDB() async { Directory documentsDirectory = await getApplicationDocumentsDirectory(); String path = join(documentsDirectory.path,"TestDB.db"); return await openDatabase(path,version: 1, onOpen: (db){ },onCreate: (Database db, int version) async{ await db.execute("CREATE TABLE todo(" "id INTEGER PRIMARY KEY," "title TEXT," "description TEXT," "startTime DATETIME," "endTime DATETIME" ")"); }); } }
0
mirrored_repositories/WORKLIST/lib
mirrored_repositories/WORKLIST/lib/modals/Todo.dart
import 'dart:convert'; class Todo{ int id; String title; String description; DateTime startTime; DateTime endTime; Todo({ this.id, this.title, this.description, this.startTime, this.endTime }); factory Todo.fromMap(Map<String, dynamic> json ) => new Todo( id: json["id"], title: json["title"], description: json["description"], startTime: json["start_time"], endTime: json["end_time"], ); Map<String, dynamic> toMap() => { "id":id, "title":title, "description":description, "startTime":startTime, "endTime":endTime, }; } Todo todoFromJson(String str){ final jsonData = json.decode(str); return Todo.fromMap(jsonData); } String todoToJson(Todo data){ final jsonObj = data.toMap(); return json.encode(jsonObj); }
0
mirrored_repositories/WORKLIST/lib
mirrored_repositories/WORKLIST/lib/screens/homescreen.dart
import 'package:flutter/material.dart'; class HomeScreen extends StatefulWidget { @override _HomeScreenState createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { List<String> _todoItems = []; void _addTodoItem(String task) { if (task.length > 0) { setState(() => _todoItems.add(task)); } } void _removeTodoItem(int index) { setState(() => _todoItems.removeAt(index)); } void _promptRemoveTodoItem(int index) { showDialog( context: context, builder: (BuildContext context) { return new AlertDialog( title: new Text('Mark "${_todoItems[index]}" as done?'), actions: <Widget>[ new FlatButton( child: new Text('CANCEL'), onPressed: () => Navigator.of(context).pop()), new FlatButton( child: new Text('MARK AS DONE'), onPressed: () { _removeTodoItem(index); Navigator.of(context).pop(); }) ]); }); } void _pushAddTodoScreen() { Navigator.of(context).push(new MaterialPageRoute(builder: (context) { return new Scaffold( appBar: new AppBar( title: new Text('Pending Works'.toUpperCase(), style: new TextStyle( fontSize: 18.0, fontWeight: FontWeight.w400, )), centerTitle: true, ), body: new SafeArea( child: new Center( child: new TextField( autofocus: true, onSubmitted: (value) { _addTodoItem(value); Navigator.pop(context); }, decoration: new InputDecoration( hintText: "Enter your task", contentPadding: const EdgeInsets.all(16.0)), ), ), ), ); })); } // Build the whole list of todo items Widget _buildTodoList() { return new ListView.builder( itemBuilder: (context, index) { // itemBuilder will be automatically be called as many times as it takes for the // list to fill up its available space, which is most likely more than the // number of todo items we have. So, we need to check the index is OK. Widget todoitem; (index < _todoItems.length) ? (todoitem = _buildTodoItem(_todoItems[index], index)) : (todoitem = null); return todoitem; }, ); } // Build a single todo item Widget _buildTodoItem(String todoText, int index) { return new ListTile( title: new Text(todoText), onTap: () => _promptRemoveTodoItem(index)); } @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('Pending Works'.toUpperCase(), style: new TextStyle( fontSize: 18.0, fontWeight: FontWeight.w400, )), centerTitle: true, ), body: new SafeArea(child: _buildTodoList()), floatingActionButton: new FloatingActionButton( onPressed: _pushAddTodoScreen, tooltip: 'Add task', child: new Icon(Icons.add)), ); } }
0
mirrored_repositories/WORKLIST
mirrored_repositories/WORKLIST/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:truedo/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(TruedoApp()); // 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/before_after_example
mirrored_repositories/before_after_example/lib/main.dart
import 'package:before_after_example/widget/effect_horizontal_widget.dart'; import 'package:before_after_example/widget/effect_vertical_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); await SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, ]); runApp(MyApp()); } class MyApp extends StatelessWidget { static final String title = 'Before After'; @override Widget build(BuildContext context) => MaterialApp( debugShowCheckedModeBanner: false, title: title, theme: ThemeData(primarySwatch: Colors.red), home: MainPage(title: title), ); } class MainPage extends StatefulWidget { final String title; const MainPage({ @required this.title, }); @override _MainPageState createState() => _MainPageState(); } class _MainPageState extends State<MainPage> { int index = 0; @override Widget build(BuildContext context) => Scaffold( appBar: AppBar( title: Text('Before & After'), centerTitle: true, ), body: buildPages(), bottomNavigationBar: BottomNavigationBar( backgroundColor: Theme.of(context).primaryColor, selectedItemColor: Colors.white, unselectedItemColor: Colors.white70, currentIndex: index, onTap: (index) => setState(() => this.index = index), items: [ BottomNavigationBarItem( icon: Icon(Icons.swap_vert), label: 'Vertical', ), BottomNavigationBarItem( icon: Icon(Icons.swap_horiz), label: 'Horizontal', ), ], ), ); Widget buildPages() { switch (index) { case 0: return EffectVerticalWidget(); case 1: default: return EffectHorizontalWidget(); } } }
0
mirrored_repositories/before_after_example/lib
mirrored_repositories/before_after_example/lib/widget/effect_vertical_widget.dart
import 'package:before_after/before_after.dart'; import 'package:flutter/material.dart'; class EffectVerticalWidget extends StatelessWidget { @override Widget build(BuildContext context) => Padding( padding: EdgeInsets.symmetric(horizontal: 24), child: BeforeAfter( thumbColor: Colors.red, overlayColor: Colors.white24, thumbRadius: 0, imageWidth: double.infinity, imageHeight: double.infinity, isVertical: true, beforeImage: Image.asset('assets/before_1.jpg', fit: BoxFit.cover), afterImage: Image.asset('assets/after_1.jpg', fit: BoxFit.cover), ), ); }
0
mirrored_repositories/before_after_example/lib
mirrored_repositories/before_after_example/lib/widget/effect_horizontal_widget.dart
import 'package:before_after/before_after.dart'; import 'package:flutter/material.dart'; class EffectHorizontalWidget extends StatelessWidget { @override Widget build(BuildContext context) => Padding( padding: EdgeInsets.symmetric(vertical: 24), child: BeforeAfter( thumbColor: Colors.red, overlayColor: Colors.white24, imageCornerRadius: 40, thumbRadius: 24, imageWidth: double.infinity, imageHeight: double.infinity, beforeImage: Image.asset('assets/before_2.jpg', fit: BoxFit.cover), afterImage: Image.asset('assets/after_2.jpg', fit: BoxFit.cover), ), ); }
0
mirrored_repositories/Bank-profile
mirrored_repositories/Bank-profile/lib/main.dart
import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin { TabController tabController; @override void initState() { // TODO: implement initState super.initState(); tabController = new TabController(length: 5, vsync: this); } @override Widget build(BuildContext context) { return Scaffold( bottomNavigationBar: Material( color: Colors.indigo[500], shadowColor: Colors.black.withOpacity(0.5), child: TabBar( controller: tabController, indicatorColor: Colors.white, tabs: <Widget>[ new Tab(icon: Icon(Icons.home, color: Colors.white,),), new Tab(icon: Icon(Icons.chat, color: Colors.white,),), new Tab(icon: Icon(Icons.search, color: Colors.white,),), new Tab(icon: Icon(Icons.group, color: Colors.white,),), new Tab(icon: Icon(Icons.person, color: Colors.white, size: 40,),) ], ), ), appBar: AppBar( centerTitle: true, title: Text('Profile', style: TextStyle(color: Colors.white),), elevation: 0, backgroundColor: Colors.indigo[500], leading: IconButton( icon: Icon(Icons.arrow_back_ios,color: Colors.white,), onPressed:(){} ), actions: <Widget>[ IconButton( icon: Icon(Icons.more_vert, color: Colors.white,), onPressed: (){}, ) ], ), body: Container( color: Colors.white, child: Column( children: <Widget>[ Container( padding: EdgeInsets.only(top: 10), width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height/2-40, decoration: BoxDecoration( boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.7), blurRadius: 20, spreadRadius: 10, ) ], color: Colors.indigo[500], borderRadius: BorderRadius.only( bottomRight: Radius.circular(30), bottomLeft: Radius.circular(30), ) ), child: Column( children: <Widget>[ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 130), child: Container( height: 105, width: 105, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(52.5), boxShadow: [ BoxShadow( color: Colors.yellow, spreadRadius:2, ) ] ), child: CircleAvatar( radius: 50, backgroundImage: AssetImage('assets/selena.jpg'), ), ), ), ], ), SizedBox(height: 10,), Text('@selenagomez', style: TextStyle(color: Colors.white, fontWeight: FontWeight.w300),), Padding( padding: const EdgeInsets.only( bottom: 35), child: Text('Selena Gomez', style: TextStyle(color: Colors.white,fontSize: 23, fontWeight: FontWeight.bold ),), ), Padding( padding: const EdgeInsets.only(left: 20, right: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Container( height: 60, width: 60, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(30), boxShadow: [ BoxShadow( color: Colors.indigo[500], spreadRadius:1, ) ] ), child: Padding( padding: const EdgeInsets.all(4.0), child: Column( children: <Widget>[ Icon(Icons.photo_camera, color: Colors.white,), SizedBox(height: 3,), Text('Camera', style: TextStyle(color: Colors.white),) ], ), ), ), Container( height: 60, width: 60, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(30), boxShadow: [ BoxShadow( color: Colors.indigo[500], spreadRadius:1, ) ] ), child: Padding( padding: const EdgeInsets.all(4.5), child: Column( children: <Widget>[ Icon(Icons.fingerprint, color: Colors.white,), SizedBox(height: 3,), Text('Security', style: TextStyle(color: Colors.white),) ], ), ), ), Container( height: 60, width: 60, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(30), boxShadow: [ BoxShadow( color: Colors.indigo[500], spreadRadius:1, ) ] ), child: Padding( padding: const EdgeInsets.all(4.0), child: Column( children: <Widget>[ Icon(Icons.phone, color: Colors.white,), SizedBox(height: 3,), Text('Phone', style: TextStyle(color: Colors.white),) ], ), ), ), Container( height: 60, width: 60, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(30), boxShadow: [ BoxShadow( color: Colors.indigo[500], spreadRadius:1, ) ] ), child: Padding( padding: const EdgeInsets.all(4), child: Column( children: <Widget>[ Icon(Icons.settings, color: Colors.white,), SizedBox(height: 3,), Text('Settings', style: TextStyle(color: Colors.white),) ], ), ), ) ], ), ), ], ), ), Container( padding: EdgeInsets.only(top: 40, right: 34, left: 34), child: Column( children: <Widget>[ Padding( padding: const EdgeInsets.all(0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Container( height: 60, width: 85, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(5), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius:6, blurRadius: 4 ) ] ), child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: <Widget>[ Icon(Icons.dashboard, color: Colors.white,), Text('Dashboard', style: TextStyle(color: Colors.white),) ], ), ), ), Container( height: 60, width: 85, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(5), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius:6, blurRadius: 4 ) ] ), child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: <Widget>[ Icon(Icons.account_balance, color: Colors.white), Text('Balance', style: TextStyle(color: Colors.white),) ], ), ), ), Container( height: 60, width: 85, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(5), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius:6, blurRadius: 4 ) ] ), child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: <Widget>[ Icon(Icons.credit_card, color: Colors.white,), Text('CreditCard', style: TextStyle(color: Colors.white),) ], ), ), ) ], ), ), Padding( padding: const EdgeInsets.only(top: 40), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ Container( height: 60, width: 85, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(5), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius:6, blurRadius: 4 ) ] ), child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: <Widget>[ Icon(Icons.language,color: Colors.white,), Text('Language', style: TextStyle(color: Colors.white),) ], ), ), ), Container( height: 60, width: 85, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(5), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius:6, blurRadius: 4 ) ] ), child: Padding( padding: const EdgeInsets.all(8.0), child: Column(children: <Widget>[ Icon(Icons.question_answer,color: Colors.white,), Text('Questions', style: TextStyle(color: Colors.white),) ], ), ), ), Container( height: 60, width: 85, decoration: BoxDecoration( color: Colors.indigo[500], borderRadius: BorderRadius.circular(5), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius:6, blurRadius: 4 ) ] ), child: Padding( padding: const EdgeInsets.all(8.0), child: Column(children: <Widget>[ Icon(Icons.visibility,color: Colors.white,), Text('Visibility', style: TextStyle(color: Colors.white),) ], ), ), ), ], ), ) ], ), ) ], ), ), ); } }
0
mirrored_repositories/Bank-profile
mirrored_repositories/Bank-profile/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:profileui/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Food-Recipe-App-Flutter
mirrored_repositories/Food-Recipe-App-Flutter/lib/main.dart
import 'package:flutter/material.dart'; import 'package:intro/View/Introduction.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: const Introduction() ); } }
0
mirrored_repositories/Food-Recipe-App-Flutter/lib
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils/AssetsManaget.dart
class AssetsManager{ static const image1="Assets/images/1.png"; static const image2="Assets/images/2.png"; static const image3="Assets/images/3.png"; static const image4="Assets/images/4.png"; static const image5="Assets/images/5.png"; static const image6="Assets/images/6.png"; }
0
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils/Widgets/Button.dart
import 'package:flutter/material.dart'; class MyButton extends StatelessWidget { final double progress; const MyButton({super.key,required this.progress}); @override Widget build(BuildContext context) { return Container( height: 50, padding: const EdgeInsets.symmetric(horizontal: 24), decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(25)), gradient: LinearGradient( begin: Alignment.bottomLeft, end: Alignment.topRight, colors: [ const Color.fromARGB(255, 61, 225, 15), const Color.fromARGB(255, 61, 225, 15), const Color.fromARGB(255, 61, 225, 15), const Color.fromARGB(255, 61, 225, 15), const Color.fromARGB(255, 61, 225, 15).withOpacity(.3), ], ), color: Colors.amber ), child: DefaultTextStyle( style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w600, ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: 92 + progress * 32, child: Stack( fit: StackFit.passthrough, children: [ Opacity( opacity: 1 - progress, child: const Text("Get Started"), ), Opacity( opacity: progress, child: const Text( "Create account", maxLines: 1, overflow: TextOverflow.fade, softWrap: false, ), ), ], ), ), const Icon( Icons.chevron_right, size: 24, color: Colors.white, ) ], ), ), ); } }
0
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils/Widgets/SignUpForm.dart
import 'package:flutter/material.dart'; import 'InputField.dart'; class SignUpForm extends StatelessWidget { const SignUpForm({super.key}); @override Widget build(BuildContext context) { return const Padding( padding: EdgeInsets.all(24.0), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.symmetric(horizontal: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "SignUp", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 26, ), ), FlutterLogo( size: 50, ) ], ), ), SizedBox( height: 32, ), InputField(label: 'Enter your Email', icon: Icons.email), SizedBox(height: 16), InputField( label: 'Enter your Password', icon: Icons.lock, hidden: true, ), SizedBox(height: 180), Row( children: [ Text( "Already have an account?", style: TextStyle(fontSize: 16, color: Colors.grey), ),Text( " Sign in.", style: TextStyle(fontSize: 16, color: Colors.green), ), ], ) ], ), ), ); } }
0
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils/Widgets/BottomSheet.dart
import 'package:flutter/material.dart'; import 'Button.dart'; import 'SheetPage1.dart'; import 'SignUpForm.dart'; class MyBottomSheet extends StatefulWidget { const MyBottomSheet({super.key}); @override State<MyBottomSheet> createState() => _MyBottomSheetState(); } class _MyBottomSheetState extends State<MyBottomSheet> { late PageController _pageController; @override void initState() { _pageController = PageController() ..addListener(() { setState(() {}); }); super.initState(); } @override Widget build(BuildContext context) { final double position = _pageController.hasClients ? (_pageController.page ?? 0) : 0; return ClipRRect( borderRadius: const BorderRadius.only(topLeft: Radius.circular(40),topRight: Radius.circular(40)), child: SizedBox( height: 400 + position * 140, child: Stack( fit: StackFit.expand, children: [ Column( children: [ const SizedBox(height: 16), Expanded( child: PageView( controller: _pageController, children: const [ SheetPage1(), SignUpForm(), ], ), ), ], ), Positioned( height: 56, bottom: 32 + position * 140, right: 16, child: GestureDetector( onTap: () { if (_pageController.page == 0) { _pageController.animateToPage(1, duration: const Duration(milliseconds: 400), curve: Curves.ease); } }, child: MyButton(progress: position) ), ) ], ), ), ); } }
0
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils/Widgets/SheetPage1.dart
import 'package:flutter/material.dart'; class SheetPage1 extends StatelessWidget { const SheetPage1({super.key}); @override Widget build(BuildContext context) { return const Padding( padding: EdgeInsets.all(24.0), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "Global recipe delights", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 42, ), ), SizedBox( height: 16, ), Text( "Embark on a culinary journey and savor the flavors of the world", style: TextStyle(fontSize: 18, color: Colors.grey), ) ], ), ); } }
0
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils/Widgets/InputField.dart
import 'package:flutter/material.dart'; class InputField extends StatelessWidget { final String label; final IconData icon; final bool hidden; const InputField({ Key? key, required this.label, required this.icon, this.hidden = false, }) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only(bottom: 16.0), child: Row( children: [ Flexible( child: TextField( cursorColor: Colors.pink.shade400, obscureText: hidden, autocorrect: !hidden, enableSuggestions: !hidden, decoration: InputDecoration( labelText: label, labelStyle: TextStyle( color: Colors.grey.shade400, fontSize: 18, ), suffixIcon: Icon( icon, color: Colors.grey.shade400, ), focusedBorder: UnderlineInputBorder( borderSide: BorderSide( color: Colors.pink.shade400, ), ), ), ), ), ], ), ); } }
0
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils
mirrored_repositories/Food-Recipe-App-Flutter/lib/Utils/Widgets/ViewPages.dart
import 'package:flutter/material.dart'; class ViewPages extends StatelessWidget { final String image,title,about; const ViewPages({super.key, required this.image, required this.title, required this.about}); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.only(left: 50, right: 50, bottom: 60), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Column( children: <Widget>[ Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Image.asset(image, height: 300, width: double.infinity, ), ), const SizedBox(height: 30,), ], ), Text(title, style: const TextStyle( color: Colors.grey, fontSize: 30, fontWeight: FontWeight.bold ),), const SizedBox(height: 20,), Text(about, textAlign: TextAlign.center, style: const TextStyle( color: Color.fromRGBO(137, 137, 137, 1), fontSize: 20, fontWeight: FontWeight.w400 ),), ], ), ); } }
0
mirrored_repositories/Food-Recipe-App-Flutter/lib
mirrored_repositories/Food-Recipe-App-Flutter/lib/View/Introduction.dart
import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:intro/Utils/AssetsManaget.dart'; import 'package:intro/Utils/Widgets/BottomSheet.dart'; import '../Utils/Widgets/ViewPages.dart'; class Introduction extends StatefulWidget { const Introduction({super.key}); @override State<Introduction> createState() => _IntroductionState(); } class _IntroductionState extends State<Introduction> { int currentIndex=0; final PageController _controller =PageController( initialPage: 0, ); @override Widget build(BuildContext context) { return Scaffold( body: Stack( alignment: Alignment.bottomCenter, children: [ PageView( scrollDirection: Axis.horizontal, controller: _controller, onPageChanged: (value) { setState(() { currentIndex=value; }); }, children: const [ ViewPages( image: AssetsManager.image6, title: "Welcome", about: "Discover more delicious recipes from around the world"), ViewPages( image: AssetsManager.image5, title: "Cook Like a Pro", about: "Learn cooking techniques and try out new recipes in your kitchen"), ViewPages( image: AssetsManager.image2, title: "Explore", about: "Find recipes from different cuisines and satisfy your taste buds"), ], ), body() ], ), ); } Widget body(){ return SizedBox( height: 150, child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: _buildIndicator(), ), const SizedBox(height: 30,), Container( height: 3, width: 100, margin: EdgeInsets.symmetric(horizontal: 40), decoration: const BoxDecoration( color: Colors.grey ), ), const SizedBox(height: 50,), Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ myContainer("Skip") , currentIndex==2?GestureDetector( onTap: onTap, child: myContainer("Done") ) : myContainer("Next") ], ), ) ], ), ); } Widget myContainer(String txt){ return Container( height: 45, width: 100, decoration: BoxDecoration( color: Colors.amber, borderRadius: BorderRadius.circular(20) ), child: Center(child: Text(txt) ,), ); } Widget _indicator(bool isActive) { return AnimatedContainer( duration: const Duration(milliseconds: 300), height: 6, width: isActive ? 30 : 6, margin: const EdgeInsets.only(right: 5), decoration: BoxDecoration( color: Colors.green, borderRadius: BorderRadius.circular(5) ), ); } List<Widget> _buildIndicator() { List<Widget> indicators = []; for (int i = 0; i<3; i++) { if (currentIndex == i) { indicators.add(_indicator(true)); } else { indicators.add(_indicator(false)); } } return indicators; } onTap(){ showModalBottomSheet( context: context, isScrollControlled: true, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(42), topRight: Radius.circular(42), ), ), builder: (_) => const MyBottomSheet(), ); } }
0
mirrored_repositories/Food-Recipe-App-Flutter
mirrored_repositories/Food-Recipe-App-Flutter/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:intro/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/getx_firebase_integration
mirrored_repositories/getx_firebase_integration/lib/main.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'app/routes/app_pages.dart'; void main() { runApp( GetMaterialApp( debugShowCheckedModeBanner: false, title: "Application", initialRoute: AppPages.initial, getPages: AppPages.routes, ), ); }
0
mirrored_repositories/getx_firebase_integration/lib/app
mirrored_repositories/getx_firebase_integration/lib/app/widgets/dialog_err.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; void dialogError(String msg) { Get.defaultDialog( actions: [ ElevatedButton( onPressed: () => Get.back(), child: const Text("OK"), ) ], title: "Terjadi Kesalahan", content: Text( msg, textAlign: TextAlign.center, ), ); }
0
mirrored_repositories/getx_firebase_integration/lib/app
mirrored_repositories/getx_firebase_integration/lib/app/routes/app_routes.dart
part of 'app_pages.dart'; // DO NOT EDIT. This is code generated via package:get_cli/get_cli.dart abstract class Routes { Routes._(); static const HOME = _Paths.HOME; static const ADD_PRODUCT = _Paths.ADD_PRODUCT; static const EDIT_PRODUCT = _Paths.EDIT_PRODUCT; } abstract class _Paths { _Paths._(); static const HOME = '/home'; static const ADD_PRODUCT = '/add-product'; static const EDIT_PRODUCT = '/edit-product'; }
0
mirrored_repositories/getx_firebase_integration/lib/app
mirrored_repositories/getx_firebase_integration/lib/app/routes/app_pages.dart
import 'package:get/get.dart'; import '../modules/add_product/bindings/add_product_binding.dart'; import '../modules/add_product/views/add_product_view.dart'; import '../modules/edit_product/bindings/edit_product_binding.dart'; import '../modules/edit_product/views/edit_product_view.dart'; import '../modules/home/bindings/home_binding.dart'; import '../modules/home/views/home_view.dart'; part 'app_routes.dart'; class AppPages { AppPages._(); static const initial = Routes.HOME; static final routes = [ GetPage( name: _Paths.HOME, page: () => const HomeView(), binding: HomeBinding(), ), GetPage( name: _Paths.ADD_PRODUCT, page: () => const AddProductView(), binding: AddProductBinding(), ), GetPage( name: _Paths.EDIT_PRODUCT, page: () => const EditProductView(), binding: EditProductBinding(), ), ]; }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/add_product
mirrored_repositories/getx_firebase_integration/lib/app/modules/add_product/views/add_product_view.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../controllers/add_product_controller.dart'; class AddProductView extends GetView<AddProductController> { const AddProductView({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Add Product'), centerTitle: true, ), body: Padding( padding: const EdgeInsets.all(20.0), child: ListView( children: [ TextField( autocorrect: false, controller: controller.name, decoration: const InputDecoration( labelText: "Product Name", hintText: "Input product name here....", border: OutlineInputBorder(), ), ), const SizedBox(height: 10), TextField( autocorrect: false, controller: controller.price, decoration: const InputDecoration( labelText: "Product Price", hintText: "Input product price here....", border: OutlineInputBorder(), ), ), Align( alignment: Alignment.centerRight, child: ElevatedButton( onPressed: () => Get.find<AddProductController>().add( controller.name.text, controller.price.text, ), child: const Text("OK"), ), ), ], ), ), ); } }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/add_product
mirrored_repositories/getx_firebase_integration/lib/app/modules/add_product/controllers/add_product_controller.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../../data/models/product_model.dart'; import '../../../data/providers/product_provider.dart'; import '../../../widgets/dialog_err.dart'; class AddProductController extends GetxController { late TextEditingController name, price; RxList<Product> products = List<Product>.empty().obs; @override void onInit() { super.onInit(); name = TextEditingController(); price = TextEditingController(); } @override void onClose() { super.dispose(); name.dispose(); price.dispose(); } void add(String name, String prc) { if (name != '' && prc != '') { double price = double.parse(prc); ProductProvider().addProduct(name, price).then((response) { final data = Product( id: response["name"], name: name, price: price, ); products.add(data); Get.back(); }); } else { dialogError("Semua input harus terisi"); } } }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/add_product
mirrored_repositories/getx_firebase_integration/lib/app/modules/add_product/bindings/add_product_binding.dart
import 'package:get/get.dart'; import '../controllers/add_product_controller.dart'; class AddProductBinding extends Bindings { @override void dependencies() { Get.lazyPut<AddProductController>( () => AddProductController(), ); } }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/edit_product
mirrored_repositories/getx_firebase_integration/lib/app/modules/edit_product/views/edit_product_view.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../controllers/edit_product_controller.dart'; class EditProductView extends GetView<EditProductController> { const EditProductView({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Edit Product'), centerTitle: true, ), body: Padding( padding: const EdgeInsets.all(20.0), child: Column( children: [ TextField( autocorrect: false, controller: controller.name, decoration: InputDecoration( hintText: Get.arguments["name"], border: const OutlineInputBorder(), ), ), const SizedBox(height: 10), TextField( autocorrect: false, controller: controller.price, decoration: InputDecoration( hintText: Get.arguments["price"].toString(), helperText: "* Masukkan hanya angka", border: const OutlineInputBorder(), ), ), Align( alignment: Alignment.centerRight, child: ElevatedButton( onPressed: () { controller.edit( Get.arguments["id"], controller.name.text, controller.price.text, ); }, child: const Text("OK"), ), ), ], ), ), ); } }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/edit_product
mirrored_repositories/getx_firebase_integration/lib/app/modules/edit_product/controllers/edit_product_controller.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../../data/models/product_model.dart'; import '../../../data/providers/product_provider.dart'; class EditProductController extends GetxController { late TextEditingController name, price; RxList<Product> products = List<Product>.empty().obs; @override void onInit() { super.onInit(); name = TextEditingController(); price = TextEditingController(); } @override void onClose() { name.dispose(); price.dispose(); } void edit(String id, String name, String prc) { double price = double.parse(prc); ProductProvider().editProduct(id, name, price); Get.back(); } }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/edit_product
mirrored_repositories/getx_firebase_integration/lib/app/modules/edit_product/bindings/edit_product_binding.dart
import 'package:get/get.dart'; import '../controllers/edit_product_controller.dart'; class EditProductBinding extends Bindings { @override void dependencies() { Get.lazyPut<EditProductController>( () => EditProductController(), ); } }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/home
mirrored_repositories/getx_firebase_integration/lib/app/modules/home/views/home_view.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:learn_firebase/app/data/models/product_model.dart'; import 'package:learn_firebase/app/modules/home/views/list_product_view.dart'; import '../../../routes/app_pages.dart'; import '../controllers/home_controller.dart'; // import 'list_product_view.dart'; class HomeView extends GetView<HomeController> { const HomeView({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( automaticallyImplyLeading: true, title: const Text("List Products"), centerTitle: true, actions: [ IconButton( onPressed: () { Get.toNamed(Routes.ADD_PRODUCT); }, icon: const Icon(Icons.add), ) ], ), body: Obx( () => controller.products.isEmpty ? const Center(child: Text("Tidak ada produk.")) : SafeArea( child: FutureBuilder( future: controller.fetchProducts(), builder: (context, snapshot) { if (snapshot.hasError) { return const Center(child: Text("Data gagal diambil")); } else if (!snapshot.hasData) { return const Center( child: CircularProgressIndicator(), ); } else { return ListView.builder( itemCount: controller.products.length, itemBuilder: (context, index) { Product product = controller.products[index]; return ListProductView(product: product); }, ); } }, ), ), ), ); } }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/home
mirrored_repositories/getx_firebase_integration/lib/app/modules/home/views/list_product_view.dart
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../../routes/app_pages.dart'; import '../controllers/home_controller.dart'; class ListProductView extends GetView<HomeController> { const ListProductView({super.key, required this.product}); final product; @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.symmetric(vertical: 15, horizontal: 25), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), border: Border.all( color: Colors.grey, ), ), child: ListTile( onTap: () { Get.toNamed(Routes.EDIT_PRODUCT, arguments: { "id": product.id, "name": product.name, "price": product.price, }); }, leading: const CircleAvatar( child: Icon(Icons.apple), ), title: Text( product.name, style: const TextStyle(fontWeight: FontWeight.bold), ), subtitle: Text("Rp. ${product.price}"), trailing: IconButton( onPressed: () { controller.deleteProducts(product.id); }, icon: const Icon(Icons.delete_forever), ), ), ); } }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/home
mirrored_repositories/getx_firebase_integration/lib/app/modules/home/controllers/home_controller.dart
import 'dart:async'; import 'package:get/get.dart'; import '../../../data/models/product_model.dart'; import '../../../data/providers/product_provider.dart'; class HomeController extends GetxController { @override Future<void> onInit() async { super.onInit(); await fetchProducts(); } final ProductProvider _productProvider = ProductProvider(); final RxList<Product> products = <Product>[].obs; Future<List<Product>> fetchProducts() async { try { final Map<String, dynamic> responseData = await _productProvider.getProduct(); final List<Product> productList = responseData.entries .map((entry) => Product.fromJson(entry.key, entry.value)) .toList(); products.assignAll(productList); return products; } catch (e, s) { s.printError(); return []; } } void deleteProducts(String id) { ProductProvider().deleteProduct(id); } }
0
mirrored_repositories/getx_firebase_integration/lib/app/modules/home
mirrored_repositories/getx_firebase_integration/lib/app/modules/home/bindings/home_binding.dart
import 'package:get/get.dart'; import '../controllers/home_controller.dart'; class HomeBinding extends Bindings { @override void dependencies() { Get.lazyPut<HomeController>( () => HomeController(), ); } }
0
mirrored_repositories/getx_firebase_integration/lib/app/data
mirrored_repositories/getx_firebase_integration/lib/app/data/models/product_model.dart
class Product { final String id; final String name; final double price; Product({required this.id, required this.name, required this.price}); factory Product.fromJson(String id, Map<String, dynamic> json) { return Product( id: id, name: json['name'] ?? '', price: (json['price'] ?? 0.0).toDouble(), ); } Map<String, dynamic> toJson() { final data = <String, dynamic>{}; data['id'] = id; data['name'] = name; data['price'] = price; return data; } }
0
mirrored_repositories/getx_firebase_integration/lib/app/data
mirrored_repositories/getx_firebase_integration/lib/app/data/providers/product_provider.dart
import 'package:get/get.dart'; class ProductProvider extends GetConnect { final String _url = "https://getx-flutter-15e48-default-rtdb.firebaseio.com/"; Future<Map<String, dynamic>> getProduct() async { var response = await get("$_url/products.json"); return response.body; } Future<dynamic> addProduct(String name, double price) async { final response = await post("$_url" 'products.json', { "name": name, "price": price, }); return response.body; } Future<void> editProduct(String id, String name, double price) async { await patch( "$_url" 'products/$id.json', { "name": name, "price": price, }, ); } Future<void> deleteProduct(String id) async => await delete("$_url" 'products/$id.json'); }
0
mirrored_repositories/barbershop
mirrored_repositories/barbershop/lib/main.dart
import 'package:barbershop/src/barbershop_app.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:intl/date_symbol_data_local.dart'; void main() async { await initializeDateFormatting(); runApp( const ProviderScope( child: BarbershopApp(), ), ); }
0
mirrored_repositories/barbershop/lib
mirrored_repositories/barbershop/lib/src/barbershop_app.dart
import 'package:asyncstate/widget/async_state_builder.dart'; import 'package:barbershop/src/core/ui/barbershop_nav_global_key.dart'; import 'package:barbershop/src/core/ui/barbershop_theme.dart'; import 'package:barbershop/src/core/ui/widgets/barbershop_loader.dart'; import 'package:barbershop/src/features/auth/login/login_page.dart'; import 'package:barbershop/src/features/auth/register/barbershop/barbershop_register_page.dart'; import 'package:barbershop/src/features/auth/register/user/user_register_page.dart'; import 'package:barbershop/src/features/employee/register/employee_register_page.dart'; import 'package:barbershop/src/features/employee/schedule/employee_schedule_page.dart'; import 'package:barbershop/src/features/home/adm/home_adm_page.dart'; import 'package:barbershop/src/features/home/employee/home_employee_page.dart'; import 'package:barbershop/src/features/schedule/schedule_page.dart'; import 'package:barbershop/src/features/splash/splash_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; class BarbershopApp extends StatelessWidget { const BarbershopApp({super.key}); @override Widget build(BuildContext context) { return AsyncStateBuilder( customLoader: const BarbershopLoader(), builder: (asyncNavigatorObserver) { return MaterialApp( navigatorObservers: [asyncNavigatorObserver], navigatorKey: BarbershopNavGlobalKey.instance.navKey, theme: BarbershopTheme.themeData, title: 'Barbershop', home: const SplashPage(), routes: { '/auth/login': (_) => const LoginPage(), '/auth/register/user': (_) => const UserRegisterPage(), '/auth/register/barbershop': (_) => const BarbershopRegisterPage(), '/home/adm': (_) => const HomeADMPage(), '/home/employee': (_) => const HomeEmployeePage(), '/employee/register': (_) => const EmployeeRegisterPage(), '/employee/schedule': (_) => const EmployeeSchedulePage(), '/schedule': (_) => const SchedulePage(), }, locale: const Locale('pt', 'BR'), supportedLocales: const [Locale('pt', 'BR')], localizationsDelegates: const [ GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], ); }, ); } }
0
mirrored_repositories/barbershop/lib/src/features
mirrored_repositories/barbershop/lib/src/features/schedule/schedule_vm.dart
import 'package:asyncstate/asyncstate.dart'; import 'package:barbershop/src/core/fp/either.dart'; import 'package:barbershop/src/core/providers/application_providers.dart'; import 'package:barbershop/src/features/schedule/schedule_state.dart'; import 'package:barbershop/src/models/barbershop_model.dart'; import 'package:barbershop/src/models/user_model.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'schedule_vm.g.dart'; @riverpod class ScheduleVM extends _$ScheduleVM { @override ScheduleState build() => ScheduleState.initial(); void timeSelect(int hour) { if (hour == state.scheduleTime) { state = state.copyWith(scheduleHour: () => null); } else { state = state.copyWith(scheduleHour: () => hour); } } void dateSelect(DateTime date) { state = state.copyWith(scheduleDate: () => date); } Future<void> register({ required UserModel user, required String clientName, }) async { final asyncLoaderHandler = AsyncLoaderHandler()..start(); final ScheduleState(:scheduleDate, :scheduleTime) = state; final scheduleRepository = ref.read(scheduleRepositoryProvider); final BarbershopModel(id: barbershopId) = await ref.watch(getMyBarbershopProvider.future); final dto = ( barbershopId: barbershopId, userId: user.id, clientName: clientName, date: scheduleDate!, time: scheduleTime!, ); final scheduleResult = await scheduleRepository.scheduleClient(dto); switch (scheduleResult) { case Success(): state = state.copyWith(status: ScheduleStateStatus.success); case Failure(): state = state.copyWith(status: ScheduleStateStatus.error); } asyncLoaderHandler.close(); } }
0
mirrored_repositories/barbershop/lib/src/features
mirrored_repositories/barbershop/lib/src/features/schedule/schedule_vm.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND part of 'schedule_vm.dart'; // ************************************************************************** // RiverpodGenerator // ************************************************************************** String _$scheduleVMHash() => r'ef691bfe82728ed7c8de1089c00badd2e6a84092'; /// See also [ScheduleVM]. @ProviderFor(ScheduleVM) final scheduleVMProvider = AutoDisposeNotifierProvider<ScheduleVM, ScheduleState>.internal( ScheduleVM.new, name: r'scheduleVMProvider', debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') ? null : _$scheduleVMHash, dependencies: null, allTransitiveDependencies: null, ); typedef _$ScheduleVM = AutoDisposeNotifier<ScheduleState>; // ignore_for_file: type=lint // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member
0
mirrored_repositories/barbershop/lib/src/features
mirrored_repositories/barbershop/lib/src/features/schedule/schedule_state.dart
import 'package:flutter/material.dart'; enum ScheduleStateStatus { initial, success, error, } class ScheduleState { ScheduleState({ required this.status, this.scheduleTime, this.scheduleDate, }); ScheduleState.initial() : this(status: ScheduleStateStatus.initial); final ScheduleStateStatus status; final int? scheduleTime; final DateTime? scheduleDate; ScheduleState copyWith({ ScheduleStateStatus? status, ValueGetter<int?>? scheduleHour, ValueGetter<DateTime?>? scheduleDate, }) => ScheduleState( status: status ?? this.status, scheduleTime: scheduleHour != null ? scheduleHour() : scheduleTime, scheduleDate: scheduleDate != null ? scheduleDate() : this.scheduleDate, ); }
0
mirrored_repositories/barbershop/lib/src/features
mirrored_repositories/barbershop/lib/src/features/schedule/schedule_page.dart
import 'package:barbershop/src/core/ui/helpers/form_helper.dart'; import 'package:barbershop/src/core/ui/helpers/messages.dart'; import 'package:barbershop/src/core/ui/widgets/avatar_widget.dart'; import 'package:barbershop/src/core/ui/widgets/hours_panel.dart'; import 'package:barbershop/src/features/schedule/schedule_state.dart'; import 'package:barbershop/src/features/schedule/schedule_vm.dart'; import 'package:barbershop/src/features/schedule/widgets/schedule_calendar.dart'; import 'package:barbershop/src/models/user_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:intl/intl.dart'; import 'package:validatorless/validatorless.dart'; class SchedulePage extends ConsumerStatefulWidget { const SchedulePage({super.key}); @override ConsumerState<SchedulePage> createState() => _SchedulePageState(); } class _SchedulePageState extends ConsumerState<SchedulePage> { var dateFormat = DateFormat('dd/MM/yyyy'); var showCalendar = false; final formKey = GlobalKey<FormState>(); final clientController = TextEditingController(); final dateController = TextEditingController(); @override void dispose() { clientController.dispose(); dateController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { final userModel = ModalRoute.of(context)?.settings.arguments as UserModel; final scheduleVM = ref.watch(scheduleVMProvider.notifier); final employeeData = switch (userModel) { UserModelADM(:final workDays, :final workHours) => ( workDays: workDays!, workHours: workHours!, ), UserModelEmployee(:final workDays, :final workHours) => ( workDays: workDays, workHours: workHours, ), }; ref.listen( scheduleVMProvider.select((state) => state.status), (_, status) { switch (status) { case ScheduleStateStatus.initial: break; case ScheduleStateStatus.success: context.showSuccess('Cliente agendado com sucesso'); Navigator.of(context).pop(); case ScheduleStateStatus.error: context.showError('Erro ao registrar agendamento'); } }, ); return Scaffold( appBar: AppBar( title: const Text('Agendar Cliente'), ), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(24), child: Form( key: formKey, child: Center( child: Column( children: [ const AvatarWidget.withoutButton(), const SizedBox(height: 32), Text( userModel.name, style: const TextStyle( fontSize: 20, fontWeight: FontWeight.w500, ), ), const SizedBox(height: 40), TextFormField( controller: clientController, validator: Validatorless.required('Nome é obrigatório'), onTapOutside: (_) => context.unfocus(), decoration: const InputDecoration( border: OutlineInputBorder(), labelText: 'Nome do Cliente', ), ), const SizedBox(height: 10), TextFormField( controller: dateController, validator: Validatorless.required('A data é obrigatória'), readOnly: true, onTap: () { setState(() { showCalendar = true; }); context.unfocus(); }, decoration: const InputDecoration( border: OutlineInputBorder(), labelText: 'Selecione uma data', hintText: 'Selecione uma data', floatingLabelBehavior: FloatingLabelBehavior.never, suffixIcon: Icon( Icons.calendar_today, color: Colors.grey, size: 20, ), ), ), const SizedBox(height: 10), Offstage( offstage: !showCalendar, child: Column( children: [ const SizedBox(height: 24), ScheduleCalendar( workDays: employeeData.workDays, cancelPressed: () { setState(() { showCalendar = false; }); }, onOkPressed: (DateTime value) { setState(() { dateController.text = dateFormat.format(value); scheduleVM.dateSelect(value); showCalendar = false; }); }, ), ], ), ), const SizedBox(height: 24), HoursPanel.singleSelection( startTime: 6, endTime: 23, onTimePressed: scheduleVM.timeSelect, enabledTimes: employeeData.workHours, ), const SizedBox(height: 24), ElevatedButton( style: ElevatedButton.styleFrom( minimumSize: const Size.fromHeight(56), ), onPressed: () { switch (formKey.currentState?.validate()) { case null || false: context.showError('Dados incompletos'); case true: final hasHourSelected = ref.watch( scheduleVMProvider .select((state) => state.scheduleTime != null), ); if (hasHourSelected) { scheduleVM.register( user: userModel, clientName: clientController.text, ); } else { context.showError( 'Selecione um horário de atendimento', ); } } }, child: const Text('AGENDAR'), ), const SizedBox(height: 24), ], ), ), ), ), ), ); } }
0
mirrored_repositories/barbershop/lib/src/features/schedule
mirrored_repositories/barbershop/lib/src/features/schedule/widgets/schedule_calendar.dart
import 'package:barbershop/src/core/constants/constants.dart'; import 'package:barbershop/src/core/ui/helpers/messages.dart'; import 'package:flutter/material.dart'; import 'package:table_calendar/table_calendar.dart'; class ScheduleCalendar extends StatefulWidget { const ScheduleCalendar({ super.key, required this.cancelPressed, required this.onOkPressed, required this.workDays, }); final VoidCallback cancelPressed; final ValueChanged<DateTime> onOkPressed; final List<String> workDays; @override State<ScheduleCalendar> createState() => _ScheduleCalendarState(); } class _ScheduleCalendarState extends State<ScheduleCalendar> { DateTime? selectedDay; late final List<int> weekDaysEnabled; int convertWeekDay(String weekDay) => switch (weekDay.toLowerCase()) { 'seg' => DateTime.monday, 'ter' => DateTime.tuesday, 'qua' => DateTime.wednesday, 'qui' => DateTime.thursday, 'sex' => DateTime.friday, 'sab' => DateTime.saturday, 'dom' => DateTime.sunday, _ => 0, }; @override void initState() { super.initState(); weekDaysEnabled = widget.workDays.map(convertWeekDay).toList(); } @override Widget build(BuildContext context) { final ScheduleCalendar(:cancelPressed, :onOkPressed) = widget; return Container( padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: const Color(0xffe6e2e9), borderRadius: BorderRadius.circular(16), ), child: Column( children: [ TableCalendar( availableGestures: AvailableGestures.none, headerStyle: const HeaderStyle(titleCentered: true), focusedDay: DateTime.now(), firstDay: DateTime.utc(1970, 1, 1), lastDay: DateTime.now().add(const Duration(days: 365 * 10)), calendarFormat: CalendarFormat.month, locale: 'pt_BR', availableCalendarFormats: const {CalendarFormat.month: 'Month'}, enabledDayPredicate: (day) => weekDaysEnabled.contains(day.weekday), onDaySelected: (selectedDay, focusedDay) { setState(() { this.selectedDay = selectedDay; }); }, selectedDayPredicate: (day) => isSameDay(selectedDay, day), calendarStyle: CalendarStyle( selectedDecoration: const BoxDecoration( color: AppColors.brown, shape: BoxShape.circle, ), todayDecoration: BoxDecoration( color: AppColors.brown.withOpacity(0.4), shape: BoxShape.circle, ), ), ), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ TextButton( onPressed: cancelPressed, child: const Text( 'Cancelar', style: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, color: AppColors.brown, ), ), ), TextButton( onPressed: () { if (selectedDay == null) { context.showError('Por favor selecione um dia'); return; } onOkPressed(selectedDay!); }, child: const Text( 'OK', style: TextStyle( fontSize: 14, fontWeight: FontWeight.bold, color: AppColors.brown, ), ), ), ], ), ], ), ); } }
0
mirrored_repositories/barbershop/lib/src/features/employee
mirrored_repositories/barbershop/lib/src/features/employee/schedule/appointment_data_source.dart
import 'package:barbershop/src/core/constants/constants.dart'; import 'package:barbershop/src/models/schedule_model.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; class AppointmentDataSource extends CalendarDataSource { AppointmentDataSource({ required this.schedules, }); final List<ScheduleModel> schedules; @override List<dynamic>? get appointments => schedules.map((e) { final ScheduleModel( date: DateTime(:year, :month, :day), :hour, :clientName, ) = e; final startTime = DateTime(year, month, day, hour, 0, 0); final endTime = DateTime(year, month, day, hour + 1, 0, 0); return Appointment( color: AppColors.brown, startTime: startTime, endTime: endTime, subject: clientName, ); }).toList(); }
0
mirrored_repositories/barbershop/lib/src/features/employee
mirrored_repositories/barbershop/lib/src/features/employee/schedule/employee_schedule_page.dart
import 'dart:developer'; import 'package:barbershop/src/core/constants/constants.dart'; import 'package:barbershop/src/core/ui/widgets/barbershop_loader.dart'; import 'package:barbershop/src/features/employee/schedule/appointment_data_source.dart'; import 'package:barbershop/src/features/employee/schedule/employee_schedule_vm.dart'; import 'package:barbershop/src/models/user_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:intl/intl.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; class EmployeeSchedulePage extends ConsumerStatefulWidget { const EmployeeSchedulePage({super.key}); @override ConsumerState<EmployeeSchedulePage> createState() => _EmployeeSchedulePageState(); } class _EmployeeSchedulePageState extends ConsumerState<EmployeeSchedulePage> { late DateTime dateSelected; var ignoreFirstLoad = true; @override void initState() { super.initState(); final DateTime(:year, :month, :day) = DateTime.now(); dateSelected = DateTime(year, month, day, 0, 0, 0); } @override Widget build(BuildContext context) { final UserModel(id: userId, :name) = ModalRoute.of(context)?.settings.arguments as UserModel; final scheduleAsync = ref.watch( employeeScheduleVMProvider(userId, dateSelected), ); return Scaffold( appBar: AppBar( title: const Text('Agenda'), ), body: Column( children: [ Text( name, style: const TextStyle( fontSize: 20, fontWeight: FontWeight.w500, ), ), const SizedBox(height: 44), scheduleAsync.when( loading: () => const BarbershopLoader(), error: (e, s) { const errorMessage = 'Erro ao carregar agendamento'; log(errorMessage, error: e, stackTrace: s); return const Center( child: Text(errorMessage), ); }, data: (schedules) { return Expanded( child: SfCalendar( allowViewNavigation: true, view: CalendarView.day, showNavigationArrow: true, todayHighlightColor: AppColors.brown, showDatePickerButton: true, showTodayButton: true, dataSource: AppointmentDataSource(schedules: schedules), onViewChanged: (viewChangedDetails) { if (ignoreFirstLoad) { ignoreFirstLoad = false; return; } final employeeSchedule = ref.read( employeeScheduleVMProvider(userId, dateSelected).notifier, ); employeeSchedule.changeDate( userId, viewChangedDetails.visibleDates.first, ); }, onTap: (calendarTapDetails) { if (calendarTapDetails.appointments?.isNotEmpty ?? false) { showModalBottomSheet( context: context, builder: (context) { final dateFormat = DateFormat('dd//MM/yyyy HH:mm'); return SizedBox( height: 200, child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( // ignore: avoid_dynamic_calls 'Cliente: ${calendarTapDetails.appointments!.first.subject}', ), Text( 'Horário: ${dateFormat.format(calendarTapDetails.date ?? DateTime.now())}', ), ], ), ), ); }, ); } }, ), ); }, ), ], ), ); } }
0