repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/text/normal_text.dart
import 'package:flutter/material.dart'; import '../../../core/extensions/app_extensions.dart'; class NormalText extends Text { NormalText({ Key? key, required String data, required BuildContext context, Color? color, FontWeight? fontWeight, double? fontSize, String? fontFamily, }) : super( data, key: key, style: TextStyle( fontWeight: fontWeight ?? FontWeight.w600, color: color ?? context.textColor, fontSize: fontSize, fontFamily: fontFamily, ), ); }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/alert/login_alert.dart
import 'package:animate_do/animate_do.dart'; import 'package:yartu_app/core/extensions/app_extensions.dart'; import 'package:flutter/material.dart'; import 'package:yartu_app/features/auth/login/viewmodel/login_view_model.dart'; import '../../../core/init/navigation/navigation_service.dart'; import '../button/special_button.dart'; class LoginAlert extends AlertDialog { LoginAlert({ Key? key, required BuildContext context, required LoginViewModel viewModel, }) : super( key: key, shape: RoundedRectangleBorder(borderRadius: context.lowBorderRadius), title: _title(context), content: _content, contentTextStyle: viewModel.normalText(context), actions: [_okButton(context)], ); static FlipInY _title(BuildContext context) => FlipInY( child: CircleAvatar( backgroundColor: context.red, child: Icon( Icons.error, color: context.background, ), ), ); static FlipInY get _content => FlipInY( child: const Text("Wrong email or password please try again."), ); static FlipInY _okButton(BuildContext context) => FlipInY( child: SpecialButton( context: context, data: "Ok", onTap: () => NavigationService.pop(), ), ); }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/textformfield/app_text_form_field.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../../../core/extensions/app_extensions.dart'; class AppTextFormField extends TextFormField { AppTextFormField({ Key? key, required BuildContext context, String? labelText, TextStyle? labelStyle, String? hintText, TextStyle? hintStyle, String? initialValue, String? Function(String?)? validator, Function(String?)? onSaved, Function(String)? onChanged, bool saveAttempted = false, TextInputAction textInputAction = TextInputAction.next, TextInputType? keyboardType, bool obscureText = false, EdgeInsetsGeometry? contentPadding, IconButton? suffixIcon, Widget? prefixIcon, Widget? prefix, Widget? suffix, String? errorText, List<TextInputFormatter>? inputFormatters, OutlineInputBorder? enabledBorder, OutlineInputBorder? focusedBorder, TextEditingController? controller, }) : super( initialValue: initialValue, autovalidateMode: saveAttempted ? AutovalidateMode.always : AutovalidateMode.disabled, controller: controller, textInputAction: textInputAction, keyboardType: keyboardType, obscureText: obscureText, inputFormatters: inputFormatters, decoration: InputDecoration( contentPadding: contentPadding, prefix: prefix, suffix: suffix, labelText: labelText, labelStyle: labelStyle ?? context.textTheme.subtitle1!.copyWith( color: context.secondaryTextColor, fontWeight: FontWeight.w600, ), hintText: hintText, hintStyle: hintStyle ?? context.textTheme.subtitle1!.copyWith( color: context.secondaryTextColor, fontWeight: FontWeight.w600, ), suffixIcon: suffixIcon, prefixIcon: prefixIcon, errorText: errorText, enabledBorder: enabledBorder, focusedBorder: focusedBorder, focusedErrorBorder: OutlineInputBorder( borderRadius: context.lowBorderRadius, borderSide: const BorderSide(color: Colors.red), ), errorBorder: OutlineInputBorder( borderRadius: context.lowBorderRadius, borderSide: const BorderSide(color: Colors.red), ), ), style: context.textTheme.subtitle1!.copyWith( fontWeight: FontWeight.w600, color: context.textColor, ), onSaved: onSaved, onChanged: onChanged, validator: validator, textAlign: TextAlign.left, key: key, ); }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/textformfield/bordered_text_form_field.dart
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../../../core/extensions/app_extensions.dart'; import 'app_text_form_field.dart'; class BorderedTextFormField extends AppTextFormField { BorderedTextFormField( {Key? key, required BuildContext context, String? labelText, TextStyle? labelStyle, String? hintText, TextStyle? hintStyle, String? initialValue, String? Function(String?)? validator, Function(String?)? onSaved, Function(String)? onChanged, bool saveAttempted = false, TextInputAction textInputAction = TextInputAction.next, TextInputType? keyboardType, bool obscureText = false, EdgeInsetsGeometry? contentPadding, IconButton? suffixIcon, Widget? prefixIcon, Widget? prefix, Widget? suffix, String? errorText, List<TextInputFormatter>? inputFormatters, BorderRadius? borderRadius, TextEditingController? controller}) : super( key: key, context: context, controller: controller, labelText: labelText, labelStyle: labelStyle, hintText: hintText, hintStyle: hintStyle, obscureText: obscureText, contentPadding: contentPadding, validator: validator, prefix: prefix, suffix: suffix, suffixIcon: suffixIcon, prefixIcon: prefixIcon, keyboardType: keyboardType, enabledBorder: OutlineInputBorder( borderRadius: borderRadius ?? context.lowBorderRadius, borderSide: BorderSide(color: context.grey4), ), focusedBorder: OutlineInputBorder( borderRadius: borderRadius ?? context.lowBorderRadius, borderSide: BorderSide(color: context.grey), ), ); }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/icon/secondary_color_icon.dart
import 'package:flutter/material.dart'; import '../../../core/extensions/app_extensions.dart'; class SecondaryColorIcon extends Icon { SecondaryColorIcon({ Key? key, required BuildContext context, required IconData icon, }) : super( icon, key: key, color: context.secondaryTextColor, ); }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/button/special_button.dart
import 'package:flutter/material.dart'; import '../../../core/extensions/app_extensions.dart'; import '../text/normal_text.dart'; class SpecialButton extends ElevatedButton { SpecialButton({ Key? key, void Function()? onTap, required BuildContext context, String? data, Widget? child, BorderRadiusGeometry? borderRadius, }) : super( onPressed: onTap ?? () {}, child: child ?? NormalText( data: data ?? "", context: context, color: Colors.white, ), style: _style(context, borderRadius ?? context.lowBorderRadius), key: key, ); static ButtonStyle _style( BuildContext context, BorderRadiusGeometry borderRadius) => ButtonStyle( overlayColor: MaterialStateProperty.resolveWith<Color>( (Set<MaterialState> states) { if (states.contains(MaterialState.hovered)) { return Colors.blue[300]!.withOpacity(0.2); } if (states.contains(MaterialState.focused) || states.contains(MaterialState.pressed)) { return Colors.blue[300]!.withOpacity(0.2); } return context.primaryColor; }, ), backgroundColor: MaterialStateProperty.all<Color>(context.primaryColor), shape: MaterialStateProperty.all<RoundedRectangleBorder>( RoundedRectangleBorder(borderRadius: borderRadius), ), ); }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/list/special_list_view_seperated.dart
import 'package:flutter/material.dart'; import '../../../core/extensions/app_extensions.dart'; class SpecialListViewSeperated extends StatelessWidget { final Widget child; const SpecialListViewSeperated({Key? key, required this.child}) : super(key: key); @override Widget build(BuildContext context) { return ListView.separated( padding: context.paddingNormal, physics: const BouncingScrollPhysics(), itemBuilder: (context, index) => child, separatorBuilder: (context, index) => context.emptySizedHeightBoxLow3x, itemCount: 5, ); } }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/checkbox/special_checkbox.dart
import 'package:flutter/material.dart'; import '../../../core/extensions/app_extensions.dart'; class SpecialCheckBox extends Checkbox { SpecialCheckBox( {Key? key, required BuildContext context, required bool value, required void Function(bool?)? onChanged}) : super( key: key, value: value, onChanged: onChanged ?? (value) {}, fillColor: MaterialStateProperty.all( value == true ? context.primaryColor : context.grey5, ), shape: RoundedRectangleBorder( borderRadius: context.xxLowBorderRadius, ), ); }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/items/mail_items.dart
import 'package:animate_do/animate_do.dart'; import 'package:flutter/material.dart'; import '../../../core/components/text/headline6_text.dart'; import '../../../core/extensions/app_extensions.dart'; import '../text/normal_text.dart'; class MailItems extends FadeInUp { MailItems({Key? key, required BuildContext context}) : super( key: key, child: Container( decoration: _itemDecoration(context), child: _item(context), ), ); static BoxDecoration _itemDecoration(BuildContext context) => BoxDecoration( borderRadius: context.lowBorderRadius, border: Border.all( color: context.secondaryTextColor.withOpacity(0.5), ), ); static ListTile _item(BuildContext context) => ListTile( contentPadding: context.paddingNormal, leading: _leading(context), title: _title(context), subtitle: _subtitle(context), ); static AspectRatio _leading(BuildContext context) => AspectRatio( aspectRatio: 1.15, child: Container( alignment: Alignment.center, decoration: BoxDecoration( color: context.royalBlue, borderRadius: context.lowBorderRadius, ), child: Headline6Text( context: context, data: "AA", color: Colors.white, fontFamily: "AvenirNext", ), ), ); static Widget _title(BuildContext context) => Padding( padding: EdgeInsets.only(top: context.normalValue), child: NormalText( data: "Task Examples", context: context, color: context.label, fontFamily: "AvenirNext", ), ); static Column _subtitle(BuildContext context) => Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( "Dear, yartu team lorem ipsum dolor sit amet...", style: TextStyle( color: context.label, fontWeight: FontWeight.w500, fontFamily: "AvenirNext", fontSize: 12 ), ), Icon( Icons.attach_file, color: context.secondaryTextColor, ), NormalText( data: "1 November 2021 • 14.55\n" "cihat@yartu.io", context: context, fontSize: 10, fontFamily: "AvenirNext", ), ], ); }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/items/upload_item.dart
import 'package:flutter/material.dart'; import '../../../core/extensions/app_extensions.dart'; import '../text/normal_text.dart'; class UploadItem extends ListTile { UploadItem({ Key? key, required BuildContext context, required IconData icon, required String text, Color? tileColor }) : super( key: key, leading: Wrap( crossAxisAlignment: WrapCrossAlignment.center, spacing: context.lowValue, children: [ Icon(icon), NormalText(data: text, context: context), ], ), onTap: () {}, tileColor: tileColor ); }
0
mirrored_repositories/yartu_app/lib/product/components
mirrored_repositories/yartu_app/lib/product/components/items/drawer_item.dart
import 'package:flutter/material.dart'; import '../../../core/extensions/app_extensions.dart'; class DrawerItem extends InkWell { DrawerItem({ Key? key, required BuildContext context, required IconData icon, required String text, void Function()? onTap, }) : super( key: key, onTap: onTap ?? (){}, child: Padding( padding: context.verticalPaddingLow, key: key, child: Wrap( crossAxisAlignment: WrapCrossAlignment.center, spacing: context.lowValue, children: [ Icon( icon, color: context.textColor, ), Text( text, style: TextStyle( color: context.textColor, fontWeight: FontWeight.w600), ) ], ), ), ); }
0
mirrored_repositories/yartu_app
mirrored_repositories/yartu_app/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:yartu_app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/fotbal-bartar
mirrored_repositories/fotbal-bartar/lib/screen.dart
import 'package:flutter/material.dart'; import 'package:score_souccer/data/model/LeagueStandings.dart'; import 'package:score_souccer/data/model/team.dart'; import 'package:score_souccer/leage/Leage.dart'; // ignore: must_be_immutable class Screen extends StatefulWidget { List<team>? teams; List<score>? scors; Screen({Key? key, this.scors, this.teams}) : super(key: key); @override State<Screen> createState() => _ScreenState(); } class _ScreenState extends State<Screen> { ThemeData a = ThemeData.dark(); List<team>? getteams; List<score>? getscors; @override void initState() { super.initState(); getscors = widget.scors!; getteams = widget.teams!; } @override Widget build(BuildContext context) { return MaterialApp( theme: a, debugShowCheckedModeBanner: false, home: DefaultTabController( initialIndex: 0, length: 4, child: Scaffold( appBar: AppBar( backgroundColor: a == ThemeData.light() ? Colors.green : Colors.grey[800], actions: [ if (a == ThemeData.light()) IconButton( onPressed: () { setState(() { a = ThemeData.dark(); }); }, icon: Icon(Icons.mode_night_outlined)), if (a == ThemeData.dark()) IconButton( onPressed: () { setState(() { a = ThemeData.light(); }); }, icon: Icon(Icons.sunny)), ], title: Text('fotball bartar'), bottom: TabBar( isScrollable: true, indicatorColor: Colors.white, tabs: [ Tab( text: 'Persian Gulf', ), Tab( text: 'Laliga', ), Tab( text: 'Premier League', ), Tab( text: 'Premier League', ), ], ), ), body: TabBarView( children: [ Scoreborde( scors: getscors, teams: getteams, country: 59, seson: 2780, a: a, ), Scoreborde( scors: getscors, teams: getteams, country: 113, //113 seson: 2029, a: a, ), Scoreborde( scors: getscors, teams: getteams, country: 42, //42 seson: 1980, a: a, ), Scoreborde( scors: getscors, teams: getteams, country: 48, //42 seson: 2020, a: a, ), ], ), ), ), ); } }
0
mirrored_repositories/fotbal-bartar
mirrored_repositories/fotbal-bartar/lib/main.dart
import 'package:flutter/material.dart'; import 'package:score_souccer/home.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Home(), ); } }
0
mirrored_repositories/fotbal-bartar
mirrored_repositories/fotbal-bartar/lib/home.dart
import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:score_souccer/data/model/LeagueStandings.dart'; import 'package:score_souccer/data/model/team.dart'; import 'package:score_souccer/screen.dart'; // ignore: must_be_immutable class Home extends StatefulWidget { int country_id; int season_id; Home({Key? key, this.country_id = 59, this.season_id = 2780}) : super(key: key); @override State<Home> createState() => _HomeState(); } class _HomeState extends State<Home> { @override void initState() { super.initState(); getdata(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.green, body: Center( child: SpinKitWave( color: Colors.white, size: 30, ), ), ); } void getdata() async { var response = await Dio().get( 'https://app.sportdataapi.com/api/v1/soccer/teams?apikey=f8794f20-e278-11ec-8dfb-1da5a3df623d&country_id=113'); List<team> team_inf = response.data['data'] .map<team>((object) => team.geter(object)) .toList(); var respons2 = await Dio().get( 'https://app.sportdataapi.com/api/v1/soccer/standings?apikey=f8794f20-e278-11ec-8dfb-1da5a3df623d&season_id=2029'); List<score> legescor = respons2.data['data']['standings'] .map<score>((objects) => score.geter(objects)) .toList(); print('test'); Navigator.of(context).push(MaterialPageRoute( builder: (context) => Screen( teams: team_inf, scors: legescor, ))); } }
0
mirrored_repositories/fotbal-bartar/lib
mirrored_repositories/fotbal-bartar/lib/leage/Leage.dart
import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:score_souccer/home.dart'; import 'package:dio/dio.dart'; import '../data/model/LeagueStandings.dart'; import '../data/model/team.dart'; // ignore: must_be_immutable class Scoreborde extends StatefulWidget { ThemeData? a; List<team>? teams; List<score>? scors; int? country; int? seson; Scoreborde( {Key? key, this.scors, this.teams, this.country, this.seson, this.a}) : super(key: key); @override State<Scoreborde> createState() => _ScorebordeState(); } class _ScorebordeState extends State<Scoreborde> { bool isvis = false; List<team>? getteams; List<score>? getscors; @override void initState() { super.initState(); getscors = widget.scors!; getteams = widget.teams!; setState(() { isvis = true; }); refresh(); } Widget build(BuildContext context) { return MaterialApp( theme: widget.a, debugShowCheckedModeBanner: false, home: Scaffold( body: SingleChildScrollView( child: Column( children: [ Visibility( visible: isvis, child: Center( child: SizedBox( height: 600, child: SpinKitRing( color: Colors.green, size: 50, ), ), ), ), if (!isvis) SingleChildScrollView( scrollDirection: Axis.horizontal, child: SingleChildScrollView( child: DataTable( columnSpacing: 27, columns: [ DataColumn( label: Text(''), ), DataColumn( label: Text(''), ), DataColumn( label: Text(''), ), DataColumn( label: Text('game'), ), DataColumn( label: Text('win'), ), DataColumn( label: Text('draw'), ), DataColumn( label: Text('lost'), ), // DataColumn( // label: Text('point'), // ), ], rows: [ ...List.generate( getscors!.length, (index) => DataRow( cells: [ DataCell( Text(getscors![index].position.toString())), DataCell( Center( child: Image.network( getteams![ findteam(getscors![index].team_id!)] .logo!, height: 25, alignment: Alignment.center, ), ), ), DataCell( Center( child: Text(getteams![ findteam(getscors![index].team_id!)] .short_code!), ), ), DataCell(Center( child: Text(getscors![index].game.toString()))), DataCell(Center( child: Text(getscors![index].won.toString()))), DataCell(Center( child: Text(getscors![index].draw.toString()))), DataCell(Center( child: Text(getscors![index].lost.toString()))), ], ), ), ], ), ), ), ], ), ), ), ); } int findteam(int teamid) { int count = 0; int end = 0; while (getteams!.length > count) { if (getteams![count].team_id == teamid) { end = count; } count++; } return end; } Future<List<team>> _refresh_team() async { var response = await Dio().get( 'https://app.sportdataapi.com/api/v1/soccer/teams?apikey=f8794f20-e278-11ec-8dfb-1da5a3df623d&country_id=${widget.country.toString()}'); List<team> team_inf = response.data['data'] .map<team>((object) => team.geter(object)) .toList(); return team_inf; } Future<List<score>> _refresh_legescor() async { var respons2 = await Dio().get( 'https://app.sportdataapi.com/api/v1/soccer/standings?apikey=f8794f20-e278-11ec-8dfb-1da5a3df623d&season_id=${widget.seson.toString()}'); List<score> legescor = respons2.data['data']['standings'] .map<score>((objects) => score.geter(objects)) .toList(); return legescor; } void refresh() async { List<team> teamIn = await _refresh_team(); List<score> scoree = await _refresh_legescor(); setState(() { getscors = scoree; getteams = teamIn; isvis = false; }); } } // ${widget.seson.toString()}
0
mirrored_repositories/fotbal-bartar/lib/data
mirrored_repositories/fotbal-bartar/lib/data/model/LeagueStandings.dart
class score { int? team_id; int? position; int? points; int? won; int? draw; int? lost; int? game; score(this.team_id, this.position, this.points, this.won, this.draw, this.lost, this.game); factory score.geter(Map<String, dynamic> jsonobject) { return score( jsonobject['team_id'], jsonobject['position'], jsonobject['points'], jsonobject['overall']['won'], jsonobject['overall']['draw'], jsonobject['overall']['lost'], jsonobject['overall']['games_played'], ); } }
0
mirrored_repositories/fotbal-bartar/lib/data
mirrored_repositories/fotbal-bartar/lib/data/model/team.dart
class team { int? team_id; String? name; String? short_code; String? logo; team(this.team_id, this.name, this.short_code, this.logo); factory team.geter(Map<String, dynamic> jsonobject) { return team( jsonobject['team_id'], jsonobject['name'], jsonobject['short_code'], jsonobject['logo'], ); } }
0
mirrored_repositories/fotbal-bartar
mirrored_repositories/fotbal-bartar/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:score_souccer/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter-QR-Genscan
mirrored_repositories/Flutter-QR-Genscan/lib/main.dart
import 'package:flutter/material.dart'; import 'pages/home_page.dart'; Future<void> main() async { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: const HomePage(), ); } }
0
mirrored_repositories/Flutter-QR-Genscan/lib
mirrored_repositories/Flutter-QR-Genscan/lib/pages/home_page.dart
import 'package:flutter/material.dart'; import 'package:qrgenscan/pages/scanner_page.dart'; import 'generator_page.dart'; class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override State<HomePage> createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Colors.black, title: const Text( 'QR Genscan', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), centerTitle: true, ), body: SingleChildScrollView( child: Container( padding: const EdgeInsets.all(50.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ const Text( "Welcome", style: TextStyle( fontSize: 60.0, fontWeight: FontWeight.bold, ), textAlign: TextAlign.center, ), const Text("You can Generate or Scan QR Code", style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.w400, color: Colors.black), textAlign: TextAlign.center), const Image( image: NetworkImage( 'https://media.istockphoto.com/vectors/qr-code-scan-phone-icon-in-comic-style-scanner-in-smartphone-vector-vector-id1166145556'), ), const SizedBox( height: 30.0, ), Button( 'Scan QR Code', const ScanPage(), ), const SizedBox( height: 6.0, ), Button( 'Generate QR Code', const GenerateQrCodePage(), ), const SizedBox( height: 110.0, ), const Text( "Developed by IG@kamran_hccp", style: TextStyle( fontSize: 13.0, fontWeight: FontWeight.w600, color: Colors.black), textAlign: TextAlign.center, ), ], ), ), ), ); } Widget Button(String text, Widget widget) { return Container( padding: const EdgeInsets.all(3.0), height: 50.0, child: ElevatedButton( style: ElevatedButton.styleFrom( foregroundColor: Colors.black, backgroundColor: Colors.white, shape: RoundedRectangleBorder( side: const BorderSide( color: Colors.black, width: 1.0, style: BorderStyle.solid, ), borderRadius: BorderRadius.circular( 32.0, ), ), ), onPressed: () { Navigator.push( context, MaterialPageRoute(builder: (context) => widget), ); }, child: Text( text, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ), ), ); } }
0
mirrored_repositories/Flutter-QR-Genscan/lib
mirrored_repositories/Flutter-QR-Genscan/lib/pages/generator_page.dart
import 'package:flutter/material.dart'; import 'package:qr_flutter/qr_flutter.dart'; class GenerateQrCodePage extends StatefulWidget { const GenerateQrCodePage({Key? key}) : super(key: key); @override State<GenerateQrCodePage> createState() => _GenerateQrCodePageState(); } class _GenerateQrCodePageState extends State<GenerateQrCodePage> { String qrData = 'https://www.github.com/kamranhccp'; final qrText = TextEditingController(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Colors.black, title: const Text( 'QR Code Generator', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), centerTitle: true, ), body: SingleChildScrollView( child: Container( padding: const EdgeInsets.only(top: 40.0, left: 20.0, right: 20.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ const Text("Generated QR Code", style: TextStyle( fontSize: 30.0, fontWeight: FontWeight.w600, color: Colors.black), textAlign: TextAlign.center), const SizedBox( height: 10.0, ), Container( alignment: Alignment.center, child: SizedBox( height: 250, child: QrImage( data: qrData, ), ), ), const SizedBox( height: 20.0, ), const Divider( height: 20.0, thickness: 1.0, color: Colors.black, endIndent: 42.0, indent: 42.0, ), const SizedBox( height: 20.0, ), Container( alignment: Alignment.center, padding: const EdgeInsets.only(left: 40.0, right: 40.0), child: const Text( "You can also generate your own QR Code by entering the text below", style: TextStyle( fontSize: 17.0, fontWeight: FontWeight.w400, color: Colors.black), textAlign: TextAlign.left, ), ), const SizedBox( height: 12.0, ), TextField( controller: qrText, decoration: const InputDecoration( hintText: "Enter your Data", border: OutlineInputBorder( borderRadius: BorderRadius.all( Radius.circular( 16.0, ), ), ), ), ), const SizedBox( height: 14.0, ), Container( padding: const EdgeInsets.only(left: 55.0, right: 55.0), height: 50.0, child: ElevatedButton( style: ElevatedButton.styleFrom( foregroundColor: Colors.black, backgroundColor: Colors.white, shape: RoundedRectangleBorder( side: const BorderSide( color: Colors.black, width: 1.0, style: BorderStyle.solid, ), borderRadius: BorderRadius.circular( 32.0, ), ), ), onPressed: () { if (qrText.text.isEmpty) { setState(() { qrData = "https://www.github.com/kamranhccp"; ScaffoldMessenger.of(context).showSnackBar( const SnackBar( content: Text( "Please enter some Data!", style: TextStyle(fontSize: 17.0), ), ), ); }); } else { setState(() { qrData = qrText.text; }); } }, child: const Text( "Generate QR Code", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ), ), ), const SizedBox( height: 30.0, ), ], ), ), ), ); } }
0
mirrored_repositories/Flutter-QR-Genscan/lib
mirrored_repositories/Flutter-QR-Genscan/lib/pages/scanner_page.dart
import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class ScanPage extends StatefulWidget { const ScanPage({Key? key}) : super(key: key); @override State<ScanPage> createState() => _ScanPageState(); } class _ScanPageState extends State<ScanPage> { String qrCodeResult = "Not Yet Scanned"; @override Widget build(BuildContext context) { final key = GlobalKey<ScaffoldState>(); return Scaffold( key: key, appBar: AppBar( backgroundColor: Colors.black, title: const Text( 'QR Code Scanner', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), centerTitle: true, ), body: Container( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Container( alignment: Alignment.topCenter, padding: const EdgeInsets.all(5.0), child: const Text( "Scan QR Code", style: TextStyle( fontSize: 27.0, fontWeight: FontWeight.w800, color: Colors.black), textAlign: TextAlign.center, ), ), // qr code image Container( padding: const EdgeInsets.only(bottom: 30.0, left: 70.0, right: 70.0), child: const Image( image: NetworkImage( 'http://api.qrserver.com/v1/create-qr-code/?color=000000&bgcolor=FFFFFF&data=https%3A%2F%2Fwww.instagram.com%2Fkamran_hccp&qzone=1&margin=0&size=400x400&ecc=L'), ), ), const SizedBox( height: 50.0, ), const Text( textAlign: TextAlign.center, "QR Code Result", style: TextStyle( fontSize: 24.0, fontWeight: FontWeight.w700, ), ), GestureDetector( onLongPress: () {}, child: SelectableText( qrCodeResult, textAlign: TextAlign.center, style: const TextStyle( fontSize: 16.0, fontWeight: FontWeight.w400, ), cursorColor: Colors.red, showCursor: true, toolbarOptions: const ToolbarOptions( copy: true, cut: true, paste: true, selectAll: true, ), ), ), const SizedBox( height: 10.0, ), Container( padding: const EdgeInsets.only(left: 30.0, right: 30.0, top: 20.0), height: 68.0, child: ElevatedButton( style: ElevatedButton.styleFrom( foregroundColor: Colors.black, backgroundColor: Colors.white, shape: RoundedRectangleBorder( side: const BorderSide( color: Colors.black, width: 1.0, style: BorderStyle.solid, ), borderRadius: BorderRadius.circular( 32.0, ), ), ), onPressed: () async { ScanResult codeScanner = await BarcodeScanner.scan(); setState( () { qrCodeResult = codeScanner.rawContent; }, ); //barcode scanner }, child: const Text( "Scan your QR Code", style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, ), ), ), ), ], ), ), ); } }
0
mirrored_repositories/Flutter-QR-Genscan
mirrored_repositories/Flutter-QR-Genscan/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:qrgenscan/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/BMI-Calculator-App
mirrored_repositories/BMI-Calculator-App/lib/calculation.dart
import 'dart:math'; class Calculation { Calculation({required this.height, required this.weight}); int height; int weight; double _bmi = 0; String calculateBMI() { _bmi = weight / pow(height / 100, 2); return _bmi.toStringAsFixed(1); } String result() { if (_bmi >= 25) { return 'Overweight'; } else if (_bmi > 18.5) { return 'Normal'; } else { return 'Underweight'; } } String getInterpretation(){ if (_bmi >= 25) { return 'You have a higher than normal body weight. Try exercising more.'; } else if (_bmi > 18.5) { return 'You have a normal body weight. Good job!'; } else { return 'You have a lower than normal body weight. you can eat a bit more.'; } } }
0
mirrored_repositories/BMI-Calculator-App
mirrored_repositories/BMI-Calculator-App/lib/main.dart
import 'package:flutter/material.dart'; import 'package:mybmi/screens/homescreen.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData( appBarTheme: const AppBarTheme( color: Color(0xFF00BB6E), // backgroundColor: Colors.deepPurpleAccent, ), // textTheme: const TextTheme( // bodyText1: TextStyle(color: Colors.blue), // bodyText2: TextStyle(color: Colors.blue), // ), primaryColor: Colors.white, colorScheme: ColorScheme.fromSwatch().copyWith( secondary: Colors.green, ), // scaffoldBackgroundColor: Colors.orange[100], ), title: 'Flutter Demo', home: const HomeScreen(), ); } }
0
mirrored_repositories/BMI-Calculator-App/lib
mirrored_repositories/BMI-Calculator-App/lib/widgets/nextbutton.dart
import 'package:flutter/material.dart'; class NextButton extends StatelessWidget { const NextButton({ Key? key, required this.size, required this.screen, }) : super(key: key); final Size size; final Widget screen; @override Widget build(BuildContext context) { return GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute(builder: (context) => screen), ); }, child: Padding( padding: const EdgeInsets.only(right: 12.0, bottom: 20), child: Align( alignment: Alignment.bottomRight, child: Container( width: size.width * 0.4, height: size.height * 0.07, decoration: BoxDecoration( color: const Color(0xFF00BB6E), borderRadius: BorderRadius.circular(30), ), child: Center( child: Padding( // padding: EdgeInsets.only(left: size.width * 0.1), padding: EdgeInsets.symmetric(horizontal: size.width * 0.05), child: const ListTile( title: Text( 'Next', style: TextStyle(color: Colors.white, fontSize: 20), ), trailing: Icon(Icons.arrow_forward, color: Colors.white), ), ), ), ), ), ), ); } }
0
mirrored_repositories/BMI-Calculator-App/lib
mirrored_repositories/BMI-Calculator-App/lib/widgets/textcontainer.dart
import 'package:flutter/material.dart'; class TextContainer extends StatelessWidget { const TextContainer({ Key? key, required this.size, required this.text, }) : super(key: key); final Size size; final String text; @override Widget build(BuildContext context) { return Container( width: double.infinity, height: size.height * 0.3, decoration: const BoxDecoration( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(25), bottomRight: Radius.circular(25), ), color: Color(0xFF00BB6E), ), child: Stack( children: [ Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Expanded( child: Center( child: Image.asset( 'assets/images/barbell.png', fit: BoxFit.cover, width: size.width, // added to match the width of the container height: size.height * 0.3, ), ), ), ], ), SizedBox( height: size.height * 0.07, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 45), child: Align( alignment: Alignment.bottomLeft, child: Text( '$text...', style: const TextStyle( color: Colors.white, fontSize: 35, fontWeight: FontWeight.w500, ), ), ), ), ], ), ); } }
0
mirrored_repositories/BMI-Calculator-App/lib
mirrored_repositories/BMI-Calculator-App/lib/screens/hwscreen.dart
import 'package:flutter/material.dart'; import 'package:mybmi/calculation.dart'; import 'package:mybmi/screens/resultscreen.dart'; import 'package:mybmi/widgets/textcontainer.dart'; class HWScreen extends StatefulWidget { const HWScreen({super.key}); @override State<HWScreen> createState() => _HWScreenState(); } class _HWScreenState extends State<HWScreen> { int height = 180; int weight = 70; @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return Scaffold( appBar: AppBar( title: const Text( 'BMI Calculator', style: TextStyle(fontSize: 20), ), centerTitle: true, elevation: 0, ), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ TextContainer(size: size, text: 'I have '), const SizedBox(height: 50), const Title(title: 'Height'), Padding( // padding: const EdgeInsets.only(right: 40.0), padding: EdgeInsets.only(right: size.width * 0.1), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Expanded( child: Slider( value: height.toDouble(), min: 120, max: 220, activeColor: const Color(0xFF00BB6E), inactiveColor: const Color(0xFF00BB6E).withOpacity(0.25), onChanged: (double newvalue) { setState( () { height = newvalue.round(); }, ); }, ), ), Container( width: 50, height: 25, decoration: BoxDecoration( border: Border.all( color: const Color(0xFF00BB6E).withOpacity(0.4), width: 2), ), child: Center( child: Text( '${height}cm', style: const TextStyle( // fontSize: 40, fontWeight: FontWeight.w700, color: Color(0xFF00BB6E), ), ), ), ), ], ), ), const SizedBox(height: 50), const Title(title: 'Weight'), Padding( // padding: const EdgeInsets.only(right: 40.0), padding: EdgeInsets.only(right: size.width * 0.1), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Expanded( child: Slider( value: weight.toDouble(), min: 30, max: 120, activeColor: const Color(0xFF00BB6E), inactiveColor: const Color(0xFF00BB6E).withOpacity(0.25), onChanged: (double newvalue) { setState( () { weight = newvalue.round(); }, ); }, ), ), Container( width: 50, height: 25, decoration: BoxDecoration( border: Border.all( color: const Color(0xFF00BB6E).withOpacity(0.4), width: 2), ), child: Center( child: Text( '${weight}kg', style: const TextStyle( // fontSize: 40, fontWeight: FontWeight.w700, color: Color(0xFF00BB6E), ), ), ), ), ], ), ), SizedBox(height: size.height * 0.1), GestureDetector( onTap: () { Calculation calc = Calculation(height: height, weight: weight); Navigator.push( context, MaterialPageRoute( builder: (context) => ResultScreen( bmiResult: calc.calculateBMI(), resultText: calc.result(), interpretation: calc.getInterpretation(), )), ); }, child: Padding( padding: const EdgeInsets.only(right: 12.0, bottom: 20), child: Align( alignment: Alignment.bottomCenter, child: Container( width: size.width * 0.72, height: size.height * 0.07, decoration: BoxDecoration( color: const Color(0xFF00BB6E), borderRadius: BorderRadius.circular(30), ), child: Center( child: Padding( // padding: EdgeInsets.only(left: size.width * 0.1), padding: EdgeInsets.symmetric(horizontal: size.width * 0.05), child: const ListTile( title: Text( 'Calculate your BMI', style: TextStyle(color: Colors.white, fontSize: 20), ), trailing: Icon(Icons.arrow_forward, color: Colors.white), ), ), ), ), ), ), ) ], ), ); } } class Title extends StatelessWidget { const Title({ Key? key, required this.title, }) : super(key: key); final String title; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.only(left: 15.0), child: Text( title, style: const TextStyle( fontSize: 30, fontWeight: FontWeight.w500, color: Color(0xFF00BB6E), ), ), ); } }
0
mirrored_repositories/BMI-Calculator-App/lib
mirrored_repositories/BMI-Calculator-App/lib/screens/agescreen.dart
import 'package:flutter/material.dart'; import 'package:mybmi/screens/hwscreen.dart'; import 'package:mybmi/widgets/nextbutton.dart'; import 'package:mybmi/widgets/textcontainer.dart'; class AgeScreen extends StatefulWidget { const AgeScreen({super.key}); @override State<AgeScreen> createState() => _AgeScreenState(); } class _AgeScreenState extends State<AgeScreen> { TextEditingController ageController = TextEditingController(); @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return Scaffold( appBar: AppBar( title: const Text( 'BMI Calculator', style: TextStyle(fontSize: 20), ), centerTitle: true, elevation: 0, ), body: SingleChildScrollView( child: Column( children: [ TextContainer(size: size, text: 'I am'), SizedBox(height: size.height * 0.15), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: size.width * 0.3, height: size.height * 0.1, child: TextField( controller: ageController, keyboardType: TextInputType.number, decoration: InputDecoration( border: const UnderlineInputBorder(), focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.green.withOpacity(0.5)), ), disabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.green.withOpacity(0.5)), ), enabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.green.withOpacity(0.5)), ), contentPadding: const EdgeInsets.only(top: 20), ), textAlign: TextAlign.center, style: const TextStyle( fontSize: 40, fontWeight: FontWeight.w500, color: Color(0xFF00BB6E), ), onChanged: (value) { setState(() {}); }, ), // child: ), const Text( ' years old. ', style: TextStyle( fontSize: 40, fontWeight: FontWeight.w500, color: Color(0xFF00BB6E), ), ), ], ), SizedBox(height: size.height * 0.16), NextButton(size: size, screen: const HWScreen()) ], ), ), ); } }
0
mirrored_repositories/BMI-Calculator-App/lib
mirrored_repositories/BMI-Calculator-App/lib/screens/homescreen.dart
import 'package:flutter/material.dart'; import 'package:mybmi/screens/agescreen.dart'; import '../widgets/nextbutton.dart'; import '../widgets/textcontainer.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({super.key}); @override State<HomeScreen> createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { bool mIsChecked = false; bool fIsChecked = false; @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return Scaffold( appBar: AppBar( title: const Text( 'BMI Calculator', style: TextStyle(fontSize: 20), ), centerTitle: true, elevation: 0, ), body: Column( children: [ TextContainer( size: size, text: 'I am a ', ), const SizedBox(height: 50), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( children: [ const CircleImage(gender: 'male'), Transform.scale( scale: 1.5, child: Checkbox( value: mIsChecked, onChanged: (bool? value) { setState(() { if (fIsChecked == true) { fIsChecked = false; } mIsChecked = value!; }); setState(() {}); // print('isChecked: $isChecked'); }, // activeColor: Colors.green, fillColor: MaterialStateProperty.resolveWith<Color>( (Set<MaterialState> states) { if (states.contains(MaterialState.disabled)) { return const Color(0xFF00BB6E).withOpacity(.32); } return const Color(0xFF00BB6E); }), materialTapTargetSize: MaterialTapTargetSize.padded, ), ), const Text( 'Male', style: TextStyle( fontSize: 20, fontWeight: FontWeight.w500, color: Color(0xFF00BB6E), ), ), ], ), Column( children: [ const CircleImage(gender: 'female'), Transform.scale( scale: 1.5, child: Checkbox( value: fIsChecked, onChanged: (bool? value) { setState(() { if (mIsChecked == true) { mIsChecked = false; } fIsChecked = value!; }); setState( () {}, ); // print('isChecked: $isChecked'); }, // activeColor: Colors.green, fillColor: MaterialStateProperty.resolveWith<Color>( (Set<MaterialState> states) { if (states.contains(MaterialState.disabled)) { return const Color(0xFF00BB6E).withOpacity(.32); } return const Color(0xFF00BB6E); }), materialTapTargetSize: MaterialTapTargetSize.padded, ), ), const Text( 'Female', style: TextStyle( fontSize: 20, fontWeight: FontWeight.w500, color: Color(0xFF00BB6E), ), ), ], ), ], ), SizedBox(height: size.height * 0.16), NextButton(size: size, screen: const AgeScreen()), ], ), ); } } class CircleImage extends StatelessWidget { const CircleImage({ Key? key, required this.gender, }) : super(key: key); final String gender; @override Widget build(BuildContext context) { return CircleAvatar( radius: 40, backgroundColor: const Color(0xFF00BB6E), child: CircleAvatar( radius: 35, backgroundColor: Colors.white, backgroundImage: AssetImage('assets/images/$gender.png'), ), ); } }
0
mirrored_repositories/BMI-Calculator-App/lib
mirrored_repositories/BMI-Calculator-App/lib/screens/resultscreen.dart
import 'package:flutter/material.dart'; import 'package:mybmi/screens/homescreen.dart'; class ResultScreen extends StatelessWidget { const ResultScreen( {super.key, required this.bmiResult, required this.resultText, required this.interpretation}); final String bmiResult; final String resultText; final String interpretation; @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return Scaffold( appBar: AppBar( backgroundColor: Colors.white, title: const Text( 'BMI Calculator', style: TextStyle(fontSize: 20, color: Color(0xFF00BB6E)), ), centerTitle: true, elevation: 0, iconTheme: const IconThemeData(color: Color(0xFF00BB6E)), ), body: Center( child: Column( // crossAxisAlignment: CrossAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox(height: size.height * 0.1), Image.asset('assets/images/heart.png'), SizedBox(height: size.height * 0.01), Text( '$resultText\n\nBMI:', style: const TextStyle( fontSize: 30, fontWeight: FontWeight.w500, color: Color(0xFF00BB6E), ), textAlign: TextAlign.center, ), Text( bmiResult, style: const TextStyle( fontSize: 80, fontWeight: FontWeight.w900, color: Color(0xFF00BB6E), ), ), Padding( padding: const EdgeInsets.all(25.0), child: Text( interpretation, style: const TextStyle( fontSize: 20, fontWeight: FontWeight.w500, color: Color(0xFF00BB6E), ), textAlign: TextAlign.center, ), ), SizedBox(height: size.height * 0.08), GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute(builder: (context) => const HomeScreen()), ); }, child: Padding( padding: EdgeInsets.only( right: 12.0, bottom: 30, left: size.width * 0.3), child: Align( alignment: Alignment.center, child: Container( width: size.width * 0.65, height: size.height * 0.07, decoration: BoxDecoration( color: const Color(0xFF00BB6E), borderRadius: BorderRadius.circular(30), ), child: Center( child: Padding( // padding: EdgeInsets.only(left: size.width * 0.1), padding: EdgeInsets.symmetric(horizontal: size.width * 0.05), child: const ListTile( title: Text( 'Find BMI Again!', style: TextStyle(color: Colors.white, fontSize: 20), ), trailing: Icon(Icons.arrow_forward, color: Colors.white), ), ), ), ), ), ), ), ], ), ), ); } }
0
mirrored_repositories/BMI-Calculator-App
mirrored_repositories/BMI-Calculator-App/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mybmi/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/Flutter-Circular-Menu-Sample
mirrored_repositories/Flutter-Circular-Menu-Sample/lib/circular_menu_screen.dart
import 'package:circular_menu/circular_menu.dart'; import 'package:flutter/material.dart'; class CircularMenuScreen extends StatefulWidget { @override _CircularMenuScreenState createState() => _CircularMenuScreenState(); } class _CircularMenuScreenState extends State<CircularMenuScreen> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Flutter Animated Circular Menu Sample'), ), body: CircularMenu( alignment: Alignment.center, curve: Curves.bounceOut, reverseCurve: Curves.bounceInOut, toggleButtonColor: Colors.blueAccent, items: [ CircularMenuItem( icon: Icons.home, color: Colors.greenAccent, onTap: () { }), CircularMenuItem( icon: Icons.chat, color: Colors.redAccent, onTap: () { }), CircularMenuItem( icon: Icons.search, color: Colors.purpleAccent, onTap: () { }), CircularMenuItem( icon: Icons.notifications, color: Colors.orangeAccent, onTap: () { }), CircularMenuItem( icon: Icons.settings, color: Colors.tealAccent, onTap: () { }), ], ), ); } }
0
mirrored_repositories/Flutter-Circular-Menu-Sample
mirrored_repositories/Flutter-Circular-Menu-Sample/lib/main.dart
import 'package:flutter/material.dart'; import 'package:fluttercircularmenusample/circular_menu_screen.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: CircularMenuScreen(), ); } }
0
mirrored_repositories/Flutter-Circular-Menu-Sample
mirrored_repositories/Flutter-Circular-Menu-Sample/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:fluttercircularmenusample/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/Camera_recharge_app
mirrored_repositories/Camera_recharge_app/lib/home_page.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:flutter_phone_direct_caller/flutter_phone_direct_caller.dart'; import './text_style.dart'; import './camera_recharge.dart'; import './text_recognizer.dart'; import './about_page.dart'; class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override State<HomePage> createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { final _unfocusNode = FocusNode(); final scaffoldKey = GlobalKey<ScaffoldState>(); @override void dispose() { _unfocusNode.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return WillPopScope( onWillPop: () async => false, child: Scaffold( key: scaffoldKey, backgroundColor: Colors.white, drawer: InkWell( onTap: () async { scaffoldKey.currentState!.openDrawer(); }, child: Container( width: 280, child: Drawer( elevation: 20, child: Container( width: 100, height: 100, decoration: const BoxDecoration( color: Color(0xFFFFFCFA), shape: BoxShape.rectangle, ), child: ListView( padding: EdgeInsets.zero, scrollDirection: Axis.vertical, children: [ AnimatedContainer( duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, width: 7.9, height: 128, decoration: const BoxDecoration( color: Color(0xFF009B77), ), child: Column( mainAxisSize: MainAxisSize.max, children: [ Align( alignment: const AlignmentDirectional(-0.1, 0.15), child: Container( width: 100, height: 100, padding: const EdgeInsets.only(top: 20), clipBehavior: Clip.antiAlias, decoration: const BoxDecoration( shape: BoxShape.circle, ), child: Image.asset( 'assets/images/logo.png', fit: BoxFit.contain, ), ), ), Text( 'Camera Recharge App', style: GoogleFonts.poppins( textStyle: CustomTextStyle.title), ), ], ), ), ListTile( leading: Icon( Icons.camera_rounded, color: Color(0xFF010000), ), title: GestureDetector( child: Text( 'Recharge', style: CustomTextStyle.subtitle, ), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (builder) => CameraRechargePage())); }, ), subtitle: Text( 'Recharge your account using camera and scan from gallerry or camera ', style: CustomTextStyle.subtitleText), trailing: Icon( Icons.arrow_forward_ios, color: Color(0xFF303030), size: 20, ), tileColor: Color(0xFFF5F5F5), dense: false, ), ListTile( leading: Icon( Icons.store_sharp, color: Colors.black, ), title: GestureDetector( child: Text( 'Text Recognition', style: CustomTextStyle.subtitle, ), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (builder) => TextRecognition())); }, ), subtitle: Text( 'Text recognitions', style: CustomTextStyle.subtitleText, ), trailing: Icon( Icons.arrow_forward_ios, color: Colors.black, size: 20, ), tileColor: Color(0xFFF5F5F5), dense: false, ), ListTile( leading: Icon( Icons.account_balance, color: Colors.black, ), title: Text( 'Balance', style: CustomTextStyle.subtitle, ), subtitle: Text( 'Check your Balance Enquires', style: CustomTextStyle.subtitleText, ), trailing: Icon( Icons.arrow_forward_ios, color: Color(0xFF303030), size: 20, ), tileColor: Color(0xFFF5F5F5), dense: false, ), ListTile( leading: Icon( Icons.contact_mail, color: Color(0xFF050000), ), title: GestureDetector( child: Text( 'About', style: CustomTextStyle.subtitle, ), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (builder) => AboutPage())); }, ), trailing: Icon( Icons.arrow_forward_ios, color: Color(0xFF303030), size: 20, ), tileColor: Color(0xFFF5F5F5), dense: false, ), ], ), ), ), ), ), appBar: AppBar( backgroundColor: const Color(0xFF009B77), automaticallyImplyLeading: false, leading: GestureDetector( child: const Icon( Icons.menu_rounded, color: Colors.black, size: 30, ), onTap: () async { scaffoldKey.currentState!.openDrawer(); }, ), title: const Text( 'Camera Recharge App', style: CustomTextStyle.mainTitle, ), actions: const [], centerTitle: false, elevation: 35, ), body: SafeArea( child: GestureDetector( onTap: () => FocusScope.of(context).requestFocus(_unfocusNode), child: Column( mainAxisSize: MainAxisSize.max, children: [ Align( alignment: const AlignmentDirectional(0, -0.3), child: Padding( padding: const EdgeInsetsDirectional.fromSTEB(8, 40, 0, 0), child: ElevatedButton.icon( onPressed: () async { try { await FlutterPhoneDirectCaller.callNumber("*804#"); } catch (e) { print(e); } }, icon: const Icon( Icons.account_balance, ), label: const Text( "Check Balance", ), style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF2816BC), foregroundColor: Colors.grey[300], minimumSize: const Size(88, 36), padding: const EdgeInsets.symmetric( horizontal: 20, vertical: 15), shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(15)), )), ), ), ), Align( alignment: const AlignmentDirectional(0, -0.8), child: Padding( padding: const EdgeInsetsDirectional.fromSTEB(8, 40, 0, 0), child: ElevatedButton.icon( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (builder) => const CameraRechargePage())); }, icon: const Icon( Icons.camera, ), label: const Text( "Recharge Balance", ), style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF2816BC), foregroundColor: Colors.grey[300], minimumSize: const Size(88, 36), padding: const EdgeInsets.symmetric( horizontal: 20, vertical: 15), shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(15)), )), ), ), ), Container( // alignment: const AlignmentDirectional(0, -0.9), child: Padding( padding: const EdgeInsetsDirectional.fromSTEB(8, 40, 0, 0), child: ElevatedButton.icon( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (builder) => const TextRecognition())); }, icon: const Icon( Icons.store_mall_directory_rounded, ), label: const Text( "Text Recognizer", ), style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF2816BC), foregroundColor: Colors.grey[300], minimumSize: const Size(88, 36), padding: const EdgeInsets.symmetric( horizontal: 20, vertical: 15), shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(15)), )), ), ), ), ], ), ), ), ), ); } }
0
mirrored_repositories/Camera_recharge_app
mirrored_repositories/Camera_recharge_app/lib/text_style.dart
import 'package:flutter/material.dart'; class CustomTextStyle { static const TextStyle title = TextStyle( fontSize: 16, color: Colors.white, fontWeight: FontWeight.bold, ); static const TextStyle mainTitle = TextStyle( color: Colors.white, fontSize: 22, ); static const TextStyle subtitle = TextStyle( fontSize: 14, fontWeight: FontWeight.bold, ); static const TextStyle buttonText = TextStyle( fontSize: 14, fontWeight: FontWeight.bold, ); static const TextStyle subtitleText = TextStyle( fontSize: 12, fontWeight: FontWeight.bold, ); static const TextStyle bodyText = TextStyle( fontSize: 18, color: Colors.black, fontWeight: FontWeight.w500, ); }
0
mirrored_repositories/Camera_recharge_app
mirrored_repositories/Camera_recharge_app/lib/about_page.dart
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import './text_style.dart'; class AboutPage extends StatefulWidget { const AboutPage({Key? key}) : super(key: key); @override State<AboutPage> createState() => _AboutPageState(); } class _AboutPageState extends State<AboutPage> { final _unfocusNode = FocusNode(); final scaffoldKey = GlobalKey<ScaffoldState>(); @override void dispose() { _unfocusNode.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( centerTitle: true, backgroundColor: Color(0xFF009B77), title: Text('About the Application', style: GoogleFonts.poppins(textStyle: CustomTextStyle.mainTitle)), elevation: 30, ), body: SafeArea( child: Column( mainAxisSize: MainAxisSize.max, children: [ Align( alignment: AlignmentDirectional(0, 0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(0, 10, 0, 0), child: Container( width: 100, height: 100, clipBehavior: Clip.antiAlias, decoration: BoxDecoration( shape: BoxShape.circle, ), child: Image.asset( 'assets/images/logo.png', fit: BoxFit.contain, ), ), ), ), Padding( padding: EdgeInsetsDirectional.fromSTEB(8, 0, 8, 6), child: Container( width: 437.8, height: 350, decoration: BoxDecoration( gradient: LinearGradient( colors: [ Colors.white, Color(0xFFADD8E6), Color(0xFFADD8E6), Color(0xFFADD8E6), Colors.white ], stops: [0, 0.5, 0.5, 0.5, 1], begin: AlignmentDirectional(0.1, -1), end: AlignmentDirectional(-0.1, 1), ), ), alignment: AlignmentDirectional(0, 0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB(10, 0, 10, 0), child: Text( 'This Mobile Application is provide you recharging your mobile via camera, check balance of your account and additionally text recognition from image and from camera.\n\n\nThank you for visiting our About page we appreciate your interest in getting to know us better! \n \n©2023\n\n', textAlign: TextAlign.center, style: GoogleFonts.notoSerif( textStyle: CustomTextStyle.bodyText)), ), ), ), ], ), ), ); } }
0
mirrored_repositories/Camera_recharge_app
mirrored_repositories/Camera_recharge_app/lib/camera_recharge.dart
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:google_ml_kit/google_ml_kit.dart'; import 'package:image_picker/image_picker.dart'; import 'package:flutter_phone_direct_caller/flutter_phone_direct_caller.dart'; class CameraRechargePage extends StatefulWidget { const CameraRechargePage({Key? key}) : super(key: key); @override State<CameraRechargePage> createState() => _CameraRechargePage(); } class _CameraRechargePage extends State<CameraRechargePage> { bool textScanning = false; XFile? imageFile; String scannedText = ""; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( centerTitle: true, backgroundColor: const Color(0xFF009B77), title: const Text("Charge your Balance"), ), body: SafeArea( child: SingleChildScrollView( child: Container( margin: const EdgeInsets.all(20), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ if (textScanning) const CircularProgressIndicator(), if (!textScanning && imageFile == null) Container( width: 300, height: 300, color: Color.fromARGB(255, 141, 137, 137), ), if (imageFile != null) Image.file(File(imageFile!.path)), Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( margin: const EdgeInsets.symmetric(horizontal: 5), padding: const EdgeInsets.only(top: 10, bottom: 10), child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Color(0xFF009B77), elevation: 10, shadowColor: Colors.grey, minimumSize: const Size(300, 55.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), )), onPressed: () { getImage(ImageSource.gallery); }, child: Container( margin: const EdgeInsets.symmetric( vertical: 5, horizontal: 5), child: Row( mainAxisSize: MainAxisSize.min, children: const [ Icon( Icons.image, size: 30, color: Colors.white, ), Text( "Gallery", style: TextStyle( fontSize: 15, color: Colors.white), ) ], ), ), )), Container( margin: const EdgeInsets.symmetric(horizontal: 5), padding: const EdgeInsets.only(bottom: 10), child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Color(0xFF009B77), foregroundColor: Colors.grey, shadowColor: Colors.grey[400], elevation: 10, minimumSize: const Size(300, 55), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0)), ), onPressed: () { getImage(ImageSource.camera); }, child: Container( margin: const EdgeInsets.symmetric( vertical: 5, horizontal: 5), child: Row( mainAxisSize: MainAxisSize.min, children: const [ Icon( Icons.camera_alt, size: 30, color: Colors.white, ), Text( "Camera", style: TextStyle( fontSize: 13, color: Colors.white), ) ], ), ), )), ], ), const SizedBox( height: 20, ), Container( child: Text( scannedText, style: const TextStyle(fontSize: 20), ), ) ], )), )), ); } void getImage(ImageSource source) async { try { final pickedImage = await ImagePicker().pickImage( source: source, maxHeight: 240, maxWidth: 480, ); if (pickedImage != null) { textScanning = true; imageFile = pickedImage; setState(() {}); getRecognisedText(pickedImage); } } catch (e) { textScanning = false; imageFile = null; scannedText = "Error occured while scanning"; setState(() {}); } } void getRecognisedText(XFile image) async { final inputImage = InputImage.fromFilePath(image.path); final textDetector = GoogleMlKit.vision.textRecognizer(); RecognizedText recognisedText = await textDetector.processImage(inputImage); await textDetector.close(); scannedText = ""; for (TextBlock block in recognisedText.blocks) { for (TextLine line in block.lines) { scannedText = "$scannedText${line.text}\n"; } } scannedText = scannedText.replaceAll(RegExp(r'[^0-9]'), ''); if (scannedText.trim().length == 14) { await FlutterPhoneDirectCaller.callNumber('*805*$scannedText#'); scannedText = ""; } else { scannedText = "Error please scan again."; } textScanning = false; setState(() {}); } @override void initState() { super.initState(); } }
0
mirrored_repositories/Camera_recharge_app
mirrored_repositories/Camera_recharge_app/lib/text_recognizer.dart
import 'dart:io'; import 'package:flutter/material.dart'; import 'package:google_ml_kit/google_ml_kit.dart'; import 'package:image_picker/image_picker.dart'; class TextRecognition extends StatefulWidget { const TextRecognition({Key? key}) : super(key: key); @override State<TextRecognition> createState() => _TextRecognition(); } class _TextRecognition extends State<TextRecognition> { bool textScanning = false; XFile? imageFile; String scannedText = ""; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( centerTitle: true, backgroundColor: const Color(0xFF009B77), title: const Text("Text Recognition"), ), body: SafeArea( child: SingleChildScrollView( child: Container( margin: const EdgeInsets.all(20), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ if (textScanning) const CircularProgressIndicator(), if (!textScanning && imageFile == null) Container( width: 300, height: 300, color: Color.fromARGB(255, 141, 137, 137), ), if (imageFile != null) Image.file(File(imageFile!.path)), Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( margin: const EdgeInsets.symmetric(horizontal: 5), padding: const EdgeInsets.only(top: 10, bottom : 10), child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Color(0xFF009B77), elevation: 10, shadowColor: Colors.grey, minimumSize: const Size(300, 55.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), ) ), onPressed: () { getImage(ImageSource.gallery); }, child: Container( margin: const EdgeInsets.symmetric( vertical: 5, horizontal: 5), child: Row( mainAxisSize: MainAxisSize.min, children: const [ Icon( Icons.image, size: 30, color: Colors.white, ), Text( "Gallery", style: TextStyle( fontSize: 15, color: Colors.white), ) ], ), ), )), Container( margin: const EdgeInsets.symmetric(horizontal: 5), padding: const EdgeInsets.only(bottom: 10), child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: Color(0xFF009B77), foregroundColor: Colors.grey, shadowColor: Colors.grey[400], elevation: 10, minimumSize: const Size(300, 55), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0)), ), onPressed: () { getImage(ImageSource.camera); }, child: Container( margin: const EdgeInsets.symmetric( vertical: 5, horizontal: 5), child: Row( mainAxisSize: MainAxisSize.min, children: const [ Icon( Icons.camera_alt, size: 30, color: Colors.white, ), Text( "Camera", style: TextStyle( fontSize: 13, color: Colors.white), ) ], ), ), ) ), ], ), const SizedBox( height: 20, ), Container( child: SelectableText( scannedText, style: const TextStyle(fontSize: 20), ), ) ], )), )), ); } void getImage(ImageSource source) async { try { final pickedImage = await ImagePicker().pickImage( source: source, ); if (pickedImage != null) { textScanning = true; imageFile = pickedImage; setState(() {}); getRecognisedText(pickedImage); } } catch (e) { textScanning = false; imageFile = null; scannedText = "Error occured while scanning"; setState(() {}); } } void getRecognisedText(XFile image) async { final inputImage = InputImage.fromFilePath(image.path); final textDetector = GoogleMlKit.vision.textRecognizer(); RecognizedText recognisedText = await textDetector.processImage(inputImage); await textDetector.close(); scannedText = ""; for (TextBlock block in recognisedText.blocks) { for (TextLine line in block.lines) { scannedText = "$scannedText${line.text}\n"; } } textScanning = false; setState(() {}); } @override void initState() { super.initState(); } }
0
mirrored_repositories/Camera_recharge_app
mirrored_repositories/Camera_recharge_app/lib/main.dart
import 'package:flutter/material.dart'; import './home_page.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( debugShowCheckedModeBanner: false, home: HomePage()); } }
0
mirrored_repositories/Camera_recharge_app
mirrored_repositories/Camera_recharge_app/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:camera_recharger/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/nft_app
mirrored_repositories/nft_app/lib/app.dart
export 'package:flutter/material.dart'; export 'package:nft_app/src/res/colors.dart'; export 'package:flutter_svg/flutter_svg.dart'; export 'package:flutter_screenutil/flutter_screenutil.dart'; export 'package:nft_app/src/widgets/text.dart';
0
mirrored_repositories/nft_app
mirrored_repositories/nft_app/lib/main.dart
import 'package:nft_app/screens/home/components/bottom_nav_icon.dart'; import 'package:nft_app/screens/home/screen.dart'; import 'package:nft_app/src/constants/bottom_nav.dart'; import 'package:nft_app/src/res/theme.dart'; import 'app.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return ScreenUtilInit( designSize: const Size(390, 844), minTextAdapt: true, splitScreenMode: true, builder: (context, child) { return MaterialApp( title: 'NFT App', debugShowCheckedModeBanner: false, theme: appTheme, home: const MainApp(), ); }); } } class MainApp extends StatelessWidget { const MainApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { ValueNotifier<int> selectedNav = ValueNotifier(0); return SafeArea( child: Scaffold( body: ValueListenableBuilder( valueListenable: selectedNav, builder: (context, navState, _) { return Stack( children: [ navScreens[navState], Align( alignment: Alignment.bottomCenter, child: Padding( padding: EdgeInsets.only(bottom: 22.h), child: Container( width: 330.w, height: 64.h, decoration: BoxDecoration( color: CustomColors.white, borderRadius: BorderRadius.circular(26.r), border: Border.all(color: CustomColors.borderColor), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ ...List.generate( 4, (index) => InkWell( onTap: () { selectedNav.value = index; }, child: bottomNavIcon( iconPath: bottomNavIcons[index], value: navState, index: index), )), ], ), )), ), ], ); }), ), ); } }
0
mirrored_repositories/nft_app/lib
mirrored_repositories/nft_app/lib/models/nft.dart
class NFT { final String name; final double price; final String owner; final String creator; final String imageUrl; const NFT( {required this.name, required this.price, required this.owner,required this.imageUrl, required this.creator}); }
0
mirrored_repositories/nft_app/lib/src
mirrored_repositories/nft_app/lib/src/constants/assets.dart
//ALL IMAGES const String nft1 = 'assets/images/image1.png'; const String nft2 = 'assets/images/image2.png'; const String nft3 = 'assets/images/image3.png'; const String nft4 = 'assets/images/image4.png'; const String nft5 = 'assets/images/image5.png'; const String recent1 = 'assets/images/image6.png'; const String recent2 = 'assets/images/image7.png'; const String recent3 = 'assets/images/image8.png'; const String recent4 = 'assets/images/image9.png'; const String recent5 = 'assets/images/image10.png'; const String recent6 = 'assets/images/image11.png'; const String user1 = 'assets/images/user1.png'; const String user2 = 'assets/images/user2.png'; const String user3 = 'assets/images/user3.png'; const String user4 = 'assets/images/user4.png'; const String confetti = 'assets/images/bid_success.png'; const String profileBg = 'assets/images/profile_bg.png'; //SVG FILES const String logo = 'assets/svg/logo.svg'; const String whiteLogo = 'assets/svg/logo_white.svg'; const String notificationIcon = 'assets/svg/notification.svg'; const String whiteNotificationIcon = 'assets/svg/notification_white.svg'; const String likeIcon = 'assets/svg/like.svg'; const String cartIcon = 'assets/svg/cart.svg'; const String discoverIcon = 'assets/svg/discover.svg'; const String homeIcon = 'assets/svg/home.svg'; const String profileIcon = 'assets/svg/profile.svg';
0
mirrored_repositories/nft_app/lib/src
mirrored_repositories/nft_app/lib/src/constants/nft.dart
import 'package:nft_app/models/nft.dart'; import 'assets.dart'; const List<NFT> trending = [ NFT( name: 'The Unknown', price: 2.25, owner: 'JackSparrow', imageUrl: nft1, creator: 'IamJackRider'), NFT( name: 'CryptoPunk', price: 1.02, owner: 'JackSparrow', imageUrl: nft2, creator: 'IamJackRider'), NFT( name: 'The Unknown', price: 2.25, owner: 'JackSparrow', imageUrl: nft3, creator: 'IamJackRider'), NFT( name: 'The Unknown', price: 2.25, owner: 'JackSparrow', imageUrl: nft4, creator: 'IamJackRider'), NFT( name: 'The Unknown', price: 2.25, owner: 'JackSparrow', imageUrl: nft5, creator: 'IamJackRider'), ]; List<String> recentImages = [ recent1,recent2,recent3,recent4,recent5,recent6 ];
0
mirrored_repositories/nft_app/lib/src
mirrored_repositories/nft_app/lib/src/constants/bottom_nav.dart
import 'package:flutter/material.dart'; import 'package:nft_app/screens/home/screen.dart'; import 'package:nft_app/screens/profile/screen.dart'; import 'package:nft_app/src/constants/assets.dart'; List<String> bottomNavIcons = [homeIcon, discoverIcon, cartIcon, profileIcon]; List<Widget> navScreens = const [ HomeScreen(),HomeScreen(), HomeScreen(), ProfileScreen() ];
0
mirrored_repositories/nft_app/lib/src
mirrored_repositories/nft_app/lib/src/widgets/text.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; class KText extends StatelessWidget { final String text; final double? fontSize; final FontWeight? fontWeight; final Color? color; final double? lineHeight; final TextAlign? textAlign; final FontStyle? fontStyle; final TextDecoration? decoration; final TextOverflow? overflow; final String? fontFamily; const KText(this.text, {Key? key, this.fontSize, this.fontWeight, this.color, this.fontStyle, this.lineHeight, this.textAlign, this.decoration, this.fontFamily, this.overflow}) : super(key: key); @override Widget build(BuildContext context) { return Text( text, textAlign: textAlign, overflow: overflow, style: GoogleFonts.roboto().copyWith( decoration: decoration, fontSize: fontSize ?? 14.sp, fontStyle: fontStyle, fontFamily: fontFamily, fontWeight: fontWeight ?? FontWeight.w400, color: color ?? CustomColors.textColor, height: lineHeight), ); } }
0
mirrored_repositories/nft_app/lib/src/widgets
mirrored_repositories/nft_app/lib/src/widgets/custom_shapes/nft_details.dart
import 'package:flutter/cupertino.dart'; class NFTDetailsCustomShape extends CustomClipper<Path> { @override Path getClip(Size size) { Path path = Path(); path.moveTo(30, 0); path.cubicTo(13.4315, 0, 0, 13.4315, 0, 30); path.lineTo(0, 348); path.cubicTo(0, 364.569, 13.4315, 378, 30, 378); path.lineTo(55.6176, 378); path.cubicTo(60.0359, 378, 63.6176, 374.418, 63.6176, 370); path.lineTo(63.6176, 355.153); path.cubicTo(63.6176, 338.585, 77.0491, 325.153, 93.6176, 325.153); path.lineTo(216.392, 325.153); path.cubicTo(232.961, 325.153, 246.392, 338.585, 246.392, 355.153); path.lineTo(246.392, 370); path.cubicTo(246.392, 374.418, 249.974, 378, 254.392, 378); path.lineTo(281, 378); path.cubicTo(297.569, 378, 311, 364.569, 311, 348); path.lineTo(311, 30); path.cubicTo(311, 13.4315, 297.569, 0, 281, 0); path.lineTo(30, 0); path.close(); return path; } @override bool shouldReclip(covariant CustomClipper<Path> oldClipper) { return true; } }
0
mirrored_repositories/nft_app/lib/src/widgets
mirrored_repositories/nft_app/lib/src/widgets/custom_shapes/top_seller.dart
import 'package:flutter/material.dart'; class TopSellerCustomShape extends CustomClipper<Path> { @override Path getClip(Size size) { Path path = Path(); path.moveTo(10.8793,4.75185); path.cubicTo(9.99657,2.19836,7.86038,0,5.15863,0); path.lineTo(5,0); path.cubicTo(2.23858,0,0,2.23858,0,5); path.lineTo(0,43); path.cubicTo(0,45.7614,2.23857,48,5,48); path.lineTo(130,48); path.cubicTo(132.761,48,135,45.7614,135,43); path.lineTo(135,5); path.cubicTo(135,2.23858,132.761,0,130,0); path.lineTo(48.8414,0); path.cubicTo(46.1396,0,44.0034,2.19836,43.1207,4.75185); path.cubicTo(40.8607,11.2897,34.4971,16,27,16); path.cubicTo(19.5029,16,13.1393,11.2897,10.8793,4.75185); path.close(); return path; } @override bool shouldReclip(covariant CustomClipper<Path> oldClipper) { return false; } }
0
mirrored_repositories/nft_app/lib/src/widgets
mirrored_repositories/nft_app/lib/src/widgets/custom_shapes/trending.dart
import 'dart:ui' as ui show Image; import 'package:flutter/rendering.dart'; class TrendingCustomShape extends CustomClipper<Path> { @override Path getClip(Size size) { Path path_0 = Path(); path_0.moveTo(size.width*0.1470588,0); path_0.cubicTo(size.width*0.06584069,0,0,size.height*0.05030487,0,size.height*0.1123596); path_0.lineTo(0,size.height*0.8865768); path_0.cubicTo(0,size.height*0.9486292,size.width*0.06584020,size.height*0.9989363,size.width*0.1470588,size.height*0.9989363); path_0.lineTo(size.width*0.2318858,size.height*0.9989363); path_0.cubicTo(size.width*0.2914461,size.height*0.9989363,size.width*0.3397289,size.height*0.9620449,size.width*0.3397289,size.height*0.9165393); path_0.lineTo(size.width*0.3397289,size.height*0.8074719); path_0.cubicTo(size.width*0.3397289,size.height*0.7702397,size.width*0.3792333,size.height*0.7400562,size.width*0.4279642,size.height*0.7400562); path_0.lineTo(size.width*0.8889461,size.height*0.7400562); path_0.cubicTo(size.width*0.9485049,size.height*0.7400562,size.width*0.9967892,size.height*0.7031648,size.width*0.9967892,size.height*0.6576592); path_0.lineTo(size.width*0.9967892,size.height*0.1123596); path_0.cubicTo(size.width*0.9967892,size.height*0.05030524,size.width*0.9309461,0,size.width*0.8497304,0); path_0.lineTo(size.width*0.1470588,0); path_0.close(); return path_0; Paint paint0Fill = Paint()..style = PaintingStyle.stroke; paint0Fill.color = const Color(0xffC4C4C4).withOpacity(1.0); //canvas.drawPath(path_0,paint0Fill); //canvas.drawImage(background, Offset.zero, paint0Fill); } @override bool shouldReclip(covariant CustomClipper oldClipper) { return false; } }
0
mirrored_repositories/nft_app/lib/src/widgets
mirrored_repositories/nft_app/lib/src/widgets/custom_shapes/recent.dart
import 'package:flutter/material.dart'; class RecentCustomShape extends CustomPainter { @override void paint(Canvas canvas, Size size) { Path path_0 = Path(); path_0.moveTo(0,size.height*0.2803661); path_0.cubicTo(0,size.height*0.2390232,size.width*0.007066481,size.height*0.2003554,size.width*0.01887636,size.height*0.1770723); path_0.lineTo(size.width*0.09768580,size.height*0.02170536); path_0.cubicTo(size.width*0.1048593,size.height*0.007563625,size.width*0.1133383,0,size.width*0.1220191,0); path_0.lineTo(size.width*0.9567901,0); path_0.cubicTo(size.width*0.9806543,0,size.width,size.height*0.05596446,size.width,size.height*0.1250000); path_0.lineTo(size.width,size.height*0.8750000); path_0.cubicTo(size.width,size.height*0.9440357,size.width*0.9806543,size.height,size.width*0.9567901,size.height); path_0.lineTo(size.width*0.04320988,size.height); path_0.cubicTo(size.width*0.01934568,size.height,0,size.height*0.9440357,0,size.height*0.8750000); path_0.lineTo(0,size.height*0.2803661); path_0.close(); Paint paint0Fill = Paint()..style=PaintingStyle.fill; paint0Fill.color = Colors.white.withOpacity(1.0); canvas.drawPath(path_0,paint0Fill); } @override bool shouldRepaint(covariant CustomPainter oldDelegate) { return true; } }
0
mirrored_repositories/nft_app/lib/src
mirrored_repositories/nft_app/lib/src/res/colors.dart
import 'package:flutter/material.dart'; class CustomColors { static const Color appColor = Color(0xff1DD0DF); static const Color scaffoldColor = Color(0xffe7e6f0); static const Color borderColor = Color(0xffD8D8D8); static const Color textColor = Color(0xff2A2C24); static const Color white = Colors.white; static const Color black = Colors.black; static const Color transparent = Colors.transparent; }
0
mirrored_repositories/nft_app/lib/src
mirrored_repositories/nft_app/lib/src/res/theme.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; ThemeData appTheme = ThemeData( fontFamily: GoogleFonts.roboto().fontFamily, primaryColor: CustomColors.appColor, appBarTheme: const AppBarTheme(backgroundColor: CustomColors.scaffoldColor,elevation: 0,foregroundColor: Colors.black), scaffoldBackgroundColor: CustomColors.scaffoldColor );
0
mirrored_repositories/nft_app/lib/screens
mirrored_repositories/nft_app/lib/screens/profile/screen.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; import 'package:nft_app/screens/profile/components/liked.dart'; import 'package:nft_app/screens/profile/components/my_work.dart'; import 'package:nft_app/src/constants/assets.dart'; import 'components/profile_stats.dart'; class ProfileScreen extends StatelessWidget { const ProfileScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return DefaultTabController( length: 2, child: Scaffold( body: ListView( children: [ Material( elevation: 5, shadowColor: CustomColors.borderColor.withOpacity(0.7), borderRadius: BorderRadius.only( bottomLeft: Radius.circular(60.r), bottomRight: Radius.circular(60.r)), child: Column( children: [ SizedBox( height: 455.h, width: 390.w, child: Stack( children: [ ClipRRect( borderRadius: BorderRadius.only( bottomRight: Radius.circular(60.r), bottomLeft: Radius.circular(60.r)), child: Image.asset(profileBg)), Positioned( top: 30.h, child: SizedBox( width: 390.w, child: Padding( padding: EdgeInsets.symmetric(horizontal: 20.w), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SvgPicture.asset( whiteLogo, width: 73.w, ), InkWell( onTap: () {}, child: SvgPicture.asset( whiteNotificationIcon, )), ], ), ), )), Positioned.fill( bottom: 0, child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ Image.asset(user4), Padding( padding: EdgeInsets.only(bottom: 5.h), child: KText( 'IAmJackRider', fontSize: 15.sp, fontWeight: FontWeight.w600, fontFamily: GoogleFonts.poppins().fontFamily, ), ), Container( height: 22.h, width: 104.w, decoration: BoxDecoration( gradient: const LinearGradient( transform: GradientRotation(1.6678366), colors: [ Color(0xff1DD0DF), Color(0xff1BEDFF), Color(0xff14BDEB) ]), borderRadius: BorderRadius.circular(15.r)), alignment: Alignment.center, child: KText( '#1 Seller', fontWeight: FontWeight.w500, fontFamily: GoogleFonts.poppins().fontFamily, fontSize: 10.sp, ), ) ], ), ), ], ), ), Padding( padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.h), child: Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ profileStats(title: 'Artworks', stats: '120K'), profileStats(title: 'Auctions', stats: '120K'), profileStats(title: 'Earnings', stats: '255 ETH'), ], ), ) ], ), ), const TabBar( indicatorSize: TabBarIndicatorSize.label, indicatorWeight: 3, tabs: [ Tab( text: 'My work', ), Tab( text: 'Liked', ) ]), SizedBox(height: 600.h, child: const TabBarView( children: [MyWork(), LikedItems()]), ) ], ), ), ); } }
0
mirrored_repositories/nft_app/lib/screens/profile
mirrored_repositories/nft_app/lib/screens/profile/components/profile_stats.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; Widget profileStats({required String title, required String stats}) => Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ KText( stats, fontWeight: FontWeight.w600, fontSize: 20.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), KText( title, fontFamily: GoogleFonts.poppins().fontFamily, fontSize: 15.sp, ) ], );
0
mirrored_repositories/nft_app/lib/screens/profile
mirrored_repositories/nft_app/lib/screens/profile/components/liked.dart
import 'package:nft_app/app.dart'; import 'package:nft_app/screens/home/components/recent_card.dart'; import 'package:nft_app/src/constants/nft.dart'; class LikedItems extends StatelessWidget { const LikedItems({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.symmetric(horizontal: 15.w), child: GridView.count( physics:const NeverScrollableScrollPhysics(), shrinkWrap: true, crossAxisCount: 2, children: [ recentCard(imageUrl: recentImages[4]),recentCard(imageUrl: recentImages[5]) ], ), ); } }
0
mirrored_repositories/nft_app/lib/screens/profile
mirrored_repositories/nft_app/lib/screens/profile/components/my_work.dart
import 'package:nft_app/app.dart'; import 'package:nft_app/screens/home/components/recent_card.dart'; import 'package:nft_app/src/constants/nft.dart'; class MyWork extends StatelessWidget { const MyWork({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.symmetric(horizontal: 15.w), child: GridView.count( physics:const NeverScrollableScrollPhysics(), shrinkWrap: true, crossAxisCount: 2, children: [ ...List.generate( 4, (index) => recentCard(imageUrl: recentImages[index])) ], ), ); } }
0
mirrored_repositories/nft_app/lib/screens
mirrored_repositories/nft_app/lib/screens/details/screen.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; import 'package:nft_app/models/nft.dart'; import 'package:nft_app/screens/details/components/bid_button.dart'; import 'package:nft_app/screens/details/components/creator_card.dart'; import 'package:nft_app/screens/details/components/details_header.dart'; import 'package:nft_app/src/constants/assets.dart'; class NFTDetailsScreen extends StatelessWidget { final NFT nft; const NFTDetailsScreen({Key? key, required this.nft}) : super(key: key); @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( appBar: AppBar( actions: [ Padding( padding: EdgeInsets.only(right: 20.w), child: InkWell( onTap: () {}, child: SvgPicture.asset(notificationIcon)), ) ], ), body: SingleChildScrollView( child: Padding( padding: EdgeInsets.symmetric(horizontal: 25.w), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ detailsHeader(nft), Padding( padding: EdgeInsets.symmetric(vertical: 6.h), child: KText( nft.name, fontFamily: GoogleFonts.poppins().fontFamily, fontWeight: FontWeight.w600, fontSize: 30.sp, ), ), GestureDetector( onTap: () {}, child: Container( width: 76.w, height: 22.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(11.r), gradient: const LinearGradient( transform: GradientRotation(1.6383406), colors: [Color(0xff320D6D), Color(0xff8A4CED)], stops: [0.02, 1], ), ), alignment: Alignment.center, child: KText( 'ETH ${nft.price}', color: CustomColors.white, fontSize: 10.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), ), ), Padding( padding: EdgeInsets.only(top: 8.h, bottom: 10.h), child: Row( children: [ creatorCard(title: 'Creator', nft: nft), Padding( padding: EdgeInsets.only(left: 20.w), child: creatorCard(title: 'Owner', nft: nft), ), ], ), ), Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ KText( 'Top bid by', fontSize: 12.sp, fontFamily: GoogleFonts.poppins().fontFamily, fontWeight: FontWeight.w500, ), Container( height: 17.h, width: 104.w, alignment: Alignment.center, decoration: const ShapeDecoration( shape: StadiumBorder(), color: Color(0xffeae6e6)), child: KText( '@georgeTheLord', fontSize: 12.sp, fontFamily: GoogleFonts.poppins().fontFamily, fontWeight: FontWeight.w500, ), ) ], ), Padding( padding: EdgeInsets.only(top: 10.h), child: Align( alignment: Alignment.topCenter, child: InkWell( onTap: () { showDialog( context: context, builder: (context) => Center( child: Material( borderRadius: BorderRadius.circular(20.r), color: CustomColors.white, child: Container( height: 350.h, width: 320.w, padding: EdgeInsets.symmetric( vertical: 31.h), child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset(confetti), Padding( padding: EdgeInsets.only( bottom: 6.h, top: 10.h), child: KText( 'Successfully Placed Bid', fontFamily: GoogleFonts.poppins() .fontFamily, fontSize: 20.sp, fontWeight: FontWeight.w700, ), ), KText( '“Please be active to make sure\nyour bid is on top. so, you can get\nyour NFT art.”', fontStyle: FontStyle.italic, fontSize: 10.sp, textAlign: TextAlign.center, fontFamily: GoogleFonts.poppins() .fontFamily, ), Padding( padding: EdgeInsets.only( top: 23.h), child: InkWell( onTap: () {}, child: Container( height: 43.h, width: 246.w, decoration: BoxDecoration( gradient: const LinearGradient( transform: GradientRotation( 1.6678366), colors: [ Color( 0xff1DD0DF), Color( 0xff1BEDFF), Color( 0xff14BDEB) ]), borderRadius: BorderRadius .circular( 15.r)), alignment: Alignment.center, child: KText( 'Check your cart', fontFamily: GoogleFonts .poppins() .fontFamily, fontSize: 15.sp, fontWeight: FontWeight.w600, ), ), ), ) ], )), ), )); }, child: placeBidButton())), ), SizedBox( height: 100.h, ) ], ), ), ), ), ); } }
0
mirrored_repositories/nft_app/lib/screens/details
mirrored_repositories/nft_app/lib/screens/details/components/creator_card.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; import 'package:nft_app/models/nft.dart'; import 'package:nft_app/src/constants/assets.dart'; import 'package:nft_app/src/widgets/custom_shapes/top_seller.dart'; Widget creatorCard({required String title, required NFT nft}) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.only(bottom: 7.h), child: KText( title, fontSize: 10.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), ), SizedBox( height: 83.h, width: 160.w, child: Stack( children: [ Padding( padding: EdgeInsets.only(top: 18.h), child: Align( alignment: Alignment.bottomLeft, child: SizedBox( height: 83.h, width: 160.w, child: ClipPath( clipper: TopSellerCustomShape(), child: Container( padding: EdgeInsets.only(right: 23.w), color: CustomColors.white, alignment: Alignment.centerRight, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( padding: EdgeInsets.only(bottom: 5.h), child: KText( title == 'Creator' ? nft.creator : nft.name, ), ), GestureDetector( onTap: () {}, child: Container( width: 68.w, height: 15.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(11.r), gradient: const LinearGradient( transform: GradientRotation(1.6383406), colors: [ Color(0xff320D6D), Color(0xff8A4CED) ], stops: [0.02, 1], ), ), alignment: Alignment.center, child: KText( 'ETH 22.051225', color: CustomColors.white, fontSize: 8.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), ), ) ], ), /* width: 300, height: 400,*/ ), ), ), ), ), Positioned(top: 0, left: 11.w, child: Image.asset(user3)) ], ), ), ], );
0
mirrored_repositories/nft_app/lib/screens/details
mirrored_repositories/nft_app/lib/screens/details/components/details_header.dart
import 'package:nft_app/app.dart'; import 'package:nft_app/models/nft.dart'; import 'package:nft_app/src/widgets/custom_shapes/nft_details.dart'; Widget detailsHeader(NFT nft) { return Stack( children: [ ClipPath( clipper: NFTDetailsCustomShape(), child: Image.asset( nft.imageUrl, fit: BoxFit.scaleDown, ), ), Padding( padding: const EdgeInsets.only(top: 330.0, right: 3), child: Align( alignment: Alignment.topCenter, child: Container( width: 188.w, height: 63.h, decoration: ShapeDecoration( shape: const StadiumBorder(), color: CustomColors.white, shadows: [ BoxShadow(color: CustomColors.black.withOpacity(0.08)) ]), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.center, children: [ InkWell( onTap: () {}, child: SizedBox( height: 28.w, width: 28.w, child: CircleAvatar( backgroundColor: const Color(0xffF1F1F1), child: Icon( Icons.favorite, size: 24.w, color: const Color(0xffF96900), ), )), ), InkWell( onTap: () {}, child: Icon( Icons.ios_share, size: 25.w, ), ), InkWell( onTap: () {}, child: Icon( Icons.more_horiz_rounded, size: 25.w, ), ), ], ), ), ), ) ], ); }
0
mirrored_repositories/nft_app/lib/screens/details
mirrored_repositories/nft_app/lib/screens/details/components/bid_button.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; Widget placeBidButton(){ return Container( height: 65.h, width: 310.w, decoration: BoxDecoration( gradient: const LinearGradient( transform: GradientRotation(1.6678366), colors: [ Color(0xff1DD0DF), Color(0xff1BEDFF), Color(0xff14BDEB) ]), borderRadius: BorderRadius.circular(15.r)), alignment: Alignment.center, child: KText( 'Place Bid Now', fontFamily: GoogleFonts.poppins().fontFamily, fontSize: 20.sp, ), ); }
0
mirrored_repositories/nft_app/lib/screens
mirrored_repositories/nft_app/lib/screens/home/screen.dart
import 'package:nft_app/app.dart'; import 'package:nft_app/screens/home/components/bottom_nav_icon.dart'; import 'package:nft_app/screens/home/components/recent_card.dart'; import 'package:nft_app/screens/home/components/top_seller.dart'; import 'package:nft_app/screens/home/components/trending_card.dart'; import 'package:nft_app/src/constants/assets.dart'; import 'package:nft_app/src/constants/bottom_nav.dart'; import 'package:nft_app/src/constants/nft.dart'; class HomeScreen extends StatefulWidget { const HomeScreen({Key? key}) : super(key: key); @override State<HomeScreen> createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { ValueNotifier<int> selectedNav = ValueNotifier(0); @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( appBar: AppBar( centerTitle: false, title: Padding( padding: EdgeInsets.only(left: 8.w), child: SvgPicture.asset( logo, width: 73.w, ), ), actions: [ Padding( padding: EdgeInsets.only(right: 20.w), child: InkWell( onTap: () {}, child: SvgPicture.asset(notificationIcon)), ) ], ), body: ListView( shrinkWrap: true, children: [ Padding( padding: EdgeInsets.fromLTRB(29.w, 20.h, 0, 20.h), child: KText( 'Trending', fontSize: 20.sp, fontWeight: FontWeight.w700, ), ), SizedBox( height: 380.h, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, physics: const BouncingScrollPhysics(), itemBuilder: (context, index) => Padding( padding: EdgeInsets.only(left: index == 0 ? 20.w : 12.w), child: TrendingCard(nft: trending[index]), ), itemCount: trending.length), ), Padding( padding: EdgeInsets.fromLTRB(29.w, 20.h, 0, 16.h), child: KText( 'Top Seller', fontSize: 20.sp, fontWeight: FontWeight.w700, ), ), SizedBox( height: 83.h, child: ListView.builder( itemBuilder: (context, index) => Padding( padding: EdgeInsets.only(left: index == 0 ? 22.w : 9.w), child: topSeller(), ), itemCount: 5, shrinkWrap: true, scrollDirection: Axis.horizontal, ), ), Padding( padding: EdgeInsets.fromLTRB(29.w, 20.h, 0, 10.h), child: KText( 'Recent', fontSize: 20.sp, fontWeight: FontWeight.w700, ), ), Padding( padding: EdgeInsets.symmetric(horizontal: 15.w), child: GridView.count(physics:const NeverScrollableScrollPhysics(), shrinkWrap: true, crossAxisCount: 2, children: [ ...List.generate( 6, (index) => recentCard(imageUrl: recentImages[index])) ], ), ), SizedBox(height: 100.h) ], ), )); } }
0
mirrored_repositories/nft_app/lib/screens/home
mirrored_repositories/nft_app/lib/screens/home/components/trending_details.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; import 'package:nft_app/models/nft.dart'; import 'package:nft_app/src/constants/assets.dart'; class TrendingDetails extends StatelessWidget { final NFT nft; const TrendingDetails({Key? key, required this.nft}) : super(key: key); @override Widget build(BuildContext context) { return Container( height: 130.h, width: 180.w, decoration: BoxDecoration( boxShadow: [ BoxShadow( color: CustomColors.white.withOpacity(0.06), blurRadius: 30, offset: const Offset(10, 30), ), ], color: Colors.white, border: Border.all(color: CustomColors.borderColor, width: 2), borderRadius: BorderRadius.circular(15.r), ), padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 11.h), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ KText( nft.name, fontWeight: FontWeight.w600, fontSize: 12.sp, ), GestureDetector( onTap: () {}, child: Container( width: 50.w, height: 15.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(11.r), gradient: const LinearGradient( transform: GradientRotation(1.6383406), colors: [Color(0xff320D6D), Color(0xff8A4CED)], stops: [0.02, 1], ), ), alignment: Alignment.center, child: KText( 'ETH ${nft.price}', color: CustomColors.white, fontSize: 8.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), ), ) ], ), Padding( padding: EdgeInsets.only(top: 6.h), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ KText( 'Creator', fontSize: 8.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), SizedBox( child: Chip( avatar: Image.asset( user1, filterQuality: FilterQuality.high, ), visualDensity: const VisualDensity(horizontal: -4, vertical: -4), labelPadding: EdgeInsets.zero, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, backgroundColor: const Color(0xffF1F1F1), label: KText( nft.creator, fontSize: 8.sp, )), ), ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ KText( 'Owner', fontSize: 8.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), SizedBox( child: Chip( avatar: Image.asset( user1, filterQuality: FilterQuality.high, ), visualDensity: const VisualDensity(horizontal: -4, vertical: -4), labelPadding: EdgeInsets.zero, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, backgroundColor: const Color(0xffF1F1F1), label: KText( nft.owner, fontSize: 8.sp, )), ), ], ) ], ), ), const Spacer(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( onTap: () {}, child: Container( width: 84.w, height: 24.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(11.r), gradient: const LinearGradient( transform: GradientRotation(1.6383406), colors: [ Color(0xff1DD0DF), Color(0xff1BEDFF), Color(0xff14BDEB) ], stops: [0.02, 0.5, 1], ), ), alignment: Alignment.center, child: KText( 'Place Bid', fontSize: 10.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), ), ), InkWell( onTap: () {}, child: SizedBox( height: 24.w,width: 24.w, child: CircleAvatar( backgroundColor: const Color(0xffF1F1F1), child: Icon(Icons.favorite,size:17.w,color: const Color(0xffF96900),),)), ) ], ), ], ), ); } }
0
mirrored_repositories/nft_app/lib/screens/home
mirrored_repositories/nft_app/lib/screens/home/components/trending_card.dart
import 'package:flutter/cupertino.dart'; import 'package:nft_app/app.dart'; import 'package:nft_app/models/nft.dart'; import 'package:nft_app/screens/details/screen.dart'; import 'package:nft_app/screens/home/components/trending_details.dart'; import 'package:nft_app/src/constants/assets.dart'; import 'package:nft_app/src/widgets/custom_shapes/trending.dart'; class TrendingCard extends StatelessWidget { final NFT nft; const TrendingCard({Key? key, required this.nft}) : super(key: key); @override Widget build(BuildContext context) { return InkWell( onTap: () { Navigator.push( context, CupertinoPageRoute( builder: (context) => NFTDetailsScreen(nft: nft))); }, child: SizedBox( width: 269.w, height: 375.h, child: Stack( children: [ Align( alignment: Alignment.topLeft, child: ClipPath( clipper: TrendingCustomShape(), child: Container( width: 238.w, height: 330.h, decoration: BoxDecoration( color: CustomColors.white, boxShadow: [ BoxShadow( color: CustomColors.black.withOpacity(0.1), blurRadius: 30, offset: const Offset(10, 30)) ], ), )), ), Align( alignment: Alignment.topLeft, child: Padding( padding: const EdgeInsets.all(2), child: ClipPath( clipper: TrendingCustomShape(), child: Image.asset( nft.imageUrl, //width: 203.w, height: 325.h, alignment: Alignment.center, //width: 203.w, )), ), ), Positioned( bottom: 0, left: 87.w, child: TrendingDetails( nft: nft, ), ) ], ), ), ); } }
0
mirrored_repositories/nft_app/lib/screens/home
mirrored_repositories/nft_app/lib/screens/home/components/top_seller.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; import 'package:nft_app/src/constants/assets.dart'; import 'package:nft_app/src/widgets/custom_shapes/top_seller.dart'; Widget topSeller() => SizedBox( height: 83.h, width: 146.w, child: Stack( children: [ Padding( padding: EdgeInsets.only(top: 18.h), child: Align( alignment: Alignment.bottomLeft, child: SizedBox( height: 83.h, width: 146.w, child: ClipPath( clipper: TopSellerCustomShape(), child: Container( padding: EdgeInsets.only(right: 13.w), color: CustomColors.white, alignment: Alignment.centerRight, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( padding: EdgeInsets.only(bottom: 5.h), child: const KText( 'IamJackRider', ), ), GestureDetector( onTap: () {}, child: Container( width: 68.w, height: 15.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(11.r), gradient: const LinearGradient( transform: GradientRotation(1.6383406), colors: [ Color(0xff320D6D), Color(0xff8A4CED) ], stops: [0.02, 1], ), ), alignment: Alignment.center, child: KText( 'ETH 22.051225', color: CustomColors.white, fontSize: 8.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), ), ) ], ), /* width: 300, height: 400,*/ ), ), ), ), ), Positioned(top: 0, left: 11.w, child: Image.asset(user3)) ], ), );
0
mirrored_repositories/nft_app/lib/screens/home
mirrored_repositories/nft_app/lib/screens/home/components/recent_card.dart
import 'package:google_fonts/google_fonts.dart'; import 'package:nft_app/app.dart'; import 'package:nft_app/src/constants/assets.dart'; import 'package:nft_app/src/widgets/custom_shapes/recent.dart'; Widget recentCard({required String imageUrl}) { double width = 170.w; return SizedBox( height: 200.h, width: width, child: Stack( children: [ Positioned( top: 0, left: -10, child: ClipRRect( borderRadius: BorderRadius.circular(7.r), child: Image.asset( imageUrl, fit: BoxFit.cover, ), ), ), Positioned( bottom: 0, child: CustomPaint( size: Size(width, (width * 0.345679012345679).toDouble()), painter: RecentCustomShape(), child: Container( padding: EdgeInsets.fromLTRB(19.w, 5.h, 9.w, 5.h), height: 56.h, width: 170.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.end, children: [ GestureDetector( onTap: () {}, child: Container( width: 50.w, height: 15.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(11.r), gradient: const LinearGradient( transform: GradientRotation(1.6383406), colors: [Color(0xff320D6D), Color(0xff8A4CED)], stops: [0.02, 1], ), ), alignment: Alignment.center, child: KText( 'ETH 2.25', color: CustomColors.white, fontSize: 8.sp, fontFamily: GoogleFonts.poppins().fontFamily, ), ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ KText( 'The Unknown', fontSize: 12.sp, fontWeight: FontWeight.w600, ), Container( padding: EdgeInsets.symmetric(horizontal: 3.w), decoration: const ShapeDecoration( shape: StadiumBorder(), color: Color(0XFFF1F1F1)), child: Row( children: [ Image.asset( user1, filterQuality: FilterQuality.high, ), Padding( padding: EdgeInsets.only(left: 3.w), child: KText( 'IamJackRider', fontSize: 8.sp, ), ) ], ), ), ], ) ], ), ), ), ), ], ), ); }
0
mirrored_repositories/nft_app/lib/screens/home
mirrored_repositories/nft_app/lib/screens/home/components/bottom_nav_icon.dart
import 'package:nft_app/app.dart'; Widget bottomNavIcon( {required String iconPath, required int value, required int index}) { return Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( padding: EdgeInsets.all(4.h), child: SvgPicture.asset( iconPath, color: value == index ? CustomColors.textColor : const Color(0xff878787), ), ), value == index ? Container( width: 6, height: 6, decoration: const BoxDecoration( color: CustomColors.appColor, shape: BoxShape.circle), ) : const SizedBox( height: 6, width: 6, ), ], ); }
0
mirrored_repositories/nft_app
mirrored_repositories/nft_app/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:nft_app/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/SwasthyaSetu
mirrored_repositories/SwasthyaSetu/lib/firebase_options.dart
// File generated by FlutterFire CLI. // ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; /// Default [FirebaseOptions] for use with your Firebase apps. /// /// Example: /// ```dart /// import 'firebase_options.dart'; /// // ... /// await Firebase.initializeApp( /// options: DefaultFirebaseOptions.currentPlatform, /// ); /// ``` class DefaultFirebaseOptions { static FirebaseOptions get currentPlatform { if (kIsWeb) { return web; } switch (defaultTargetPlatform) { case TargetPlatform.android: return android; case TargetPlatform.iOS: return ios; case TargetPlatform.macOS: return macos; case TargetPlatform.windows: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for windows - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); case TargetPlatform.linux: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for linux - ' 'you can reconfigure this by running the FlutterFire CLI again.', ); default: throw UnsupportedError( 'DefaultFirebaseOptions are not supported for this platform.', ); } } static const FirebaseOptions web = FirebaseOptions( apiKey: 'AIzaSyBWxGzyoI_n_lA77CdlW_f6rF5gnxeJ6t8', appId: '1:951619617188:web:6287d4252795fd1ec68131', messagingSenderId: '951619617188', projectId: 'swasthya-setu-b3039', authDomain: 'swasthya-setu-b3039.firebaseapp.com', storageBucket: 'swasthya-setu-b3039.appspot.com', ); static const FirebaseOptions android = FirebaseOptions( apiKey: 'AIzaSyCUwDg5ZrddzO1-444Qe7IcomCXTpStQv0', appId: '1:951619617188:android:73438630234898d8c68131', messagingSenderId: '951619617188', projectId: 'swasthya-setu-b3039', storageBucket: 'swasthya-setu-b3039.appspot.com', ); static const FirebaseOptions ios = FirebaseOptions( apiKey: 'AIzaSyAQFrSFNyVYeuEqK7x6C4HdVbtCQdWVYA4', appId: '1:951619617188:ios:3815e5419a30b550c68131', messagingSenderId: '951619617188', projectId: 'swasthya-setu-b3039', storageBucket: 'swasthya-setu-b3039.appspot.com', iosBundleId: 'com.example.swasthyaSetu', ); static const FirebaseOptions macos = FirebaseOptions( apiKey: 'AIzaSyAQFrSFNyVYeuEqK7x6C4HdVbtCQdWVYA4', appId: '1:951619617188:ios:424734e4e76c0d34c68131', messagingSenderId: '951619617188', projectId: 'swasthya-setu-b3039', storageBucket: 'swasthya-setu-b3039.appspot.com', iosBundleId: 'com.example.swasthyaSetu.RunnerTests', ); }
0
mirrored_repositories/SwasthyaSetu
mirrored_repositories/SwasthyaSetu/lib/main.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:swasthya_setu/doctor_pages/doctor_home_page.dart'; import 'package:swasthya_setu/firebase_options.dart'; import 'package:swasthya_setu/pages/signinoption_page.dart'; import 'package:swasthya_setu/providers/details.dart'; import 'package:swasthya_setu/user_pages/user_home_page.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return MultiProvider( providers: [ ChangeNotifierProvider( create: (context) => UserDetailsProvider(), ), ChangeNotifierProvider( create: (context) => DoctorDetailsProvider(), ) ], child: MaterialApp( routes: {'doctorHomePage': (context) => DoctorHomePage(size: size)}, theme: ThemeData(useMaterial3: true), debugShowCheckedModeBanner: false, home: StreamBuilder<User?>( stream: FirebaseAuth.instance.authStateChanges(), builder: (BuildContext context, AsyncSnapshot<User?> snapshot) { // FirebaseFirestore getData = FirebaseFirestore.instance; if (snapshot.connectionState == ConnectionState.waiting) { return const Center( child: Text("Loading.."), ); } if (snapshot.hasError) { return const Text("Loading"); } else if (snapshot.connectionState == ConnectionState.active) { if (snapshot.hasData) { User getData = snapshot.data as User; if (getData.displayName == "User") { return UserHomePage( size: size, ); } else if (getData.displayName == "Doctor") { return DoctorHomePage(size: size); } } } // print(getData.displayName); return const SignInOptionPage(); }, // child: const SignInOptionPage() ), ), ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/sidebar_doctor.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:swasthya_setu/doctor_pages/reports.dart'; import 'package:swasthya_setu/providers/details.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/drawer_item.dart'; import '../doctor_pages/doctor_home_page.dart'; import '../doctor_pages/doctor_profile_page.dart'; class SidebarDoctor extends StatefulWidget { final Size size; const SidebarDoctor({Key? key, required this.size}) : super(key: key); @override // ignore: library_private_types_in_public_api _SidebarState createState() => _SidebarState(); } class _SidebarState extends State<SidebarDoctor> { @override void initState() { super.initState(); context.read<DoctorDetailsProvider>().getDoctordetails(); } @override Widget build(BuildContext context) { Map<String, dynamic> userDetailsMap = Provider.of<DoctorDetailsProvider>(context, listen: true) .getDoctorDetailsMap; return Drawer( child: Material( color: mainwhite, child: Padding( padding: const EdgeInsets.fromLTRB(15.0, 30, 24, 0), child: Column( children: [ headerWidget(userDetailsMap, widget.size), const SizedBox(height: 20), const Divider(thickness: 1, height: 2, color: Colors.green), const SizedBox(height: 20), DrawerItem( name: 'Dashboard', icon: Icons.dashboard_outlined, onPressed: () => onItemPressed(context, index: 0), ), const SizedBox(height: 30), DrawerItem( name: 'Reports', icon: Icons.receipt, onPressed: () => onItemPressed(context, index: 1), ), const SizedBox(height: 30), DrawerItem( name: 'Appointments', icon: Icons.calendar_month, onPressed: () => onItemPressed(context, index: 2), ), ], ), ), ), ); } Widget headerWidget(Map<String, dynamic> userDetailsMap, Size size) { return GestureDetector( onTap: () { Navigator.of(context).push(MaterialPageRoute( builder: ((context) => DoctorProfilePage( size: widget.size, name: userDetailsMap['name'], number: userDetailsMap['number'], age: userDetailsMap['age'], image: userDetailsMap['photoURL'], gender: userDetailsMap['gender'], mail: userDetailsMap['email'], address: userDetailsMap['address'], )), )); }, child: Column( children: [ CircleAvatar( backgroundImage: NetworkImage("${userDetailsMap['photoURL']}"), radius: size.width * 0.2, ), const SizedBox(width: 20), Column( children: [ Text( "${userDetailsMap['name']}", style: const TextStyle( color: Colors.black, fontSize: 30, fontWeight: FontWeight.w600), ), const SizedBox(width: 20), Text( "${userDetailsMap['specialization']}", style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 15), ), ], ), ], ), ); } void onItemPressed(BuildContext context, {required int index}) { Navigator.pop(context); switch (index) { case 0: Navigator.push( context, MaterialPageRoute( builder: (context) => DoctorHomePage(size: widget.size))); break; case 1: Navigator.push( context, MaterialPageRoute( builder: (context) => Reports( userUid: FirebaseAuth.instance.currentUser!.uid, ))); break; case 2: Navigator.push( context, MaterialPageRoute( builder: (context) => DoctorHomePage(size: widget.size))); break; default: Navigator.pop(context); break; } } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/contacts.dart
import 'package:flutter/material.dart'; class Contacts extends StatelessWidget { final IconData icon; final String value; final Size size; const Contacts({super.key, required this.icon, required this.value, required this.size}); @override Widget build(BuildContext context) { return Row( children: [ Icon(icon), SizedBox(width: 2,), Text( value, style: TextStyle( fontSize: size.height * 0.02, fontWeight: FontWeight.w500,color: Colors.blue.shade700), ) ], ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/doctorcard.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:swasthya_setu/pages/bookingpage.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/gettime.dart'; import 'package:swasthya_setu/widgets/textwidget.dart'; // Widget doctorCard(Size size, DocumentSnapshot document, BuildContext context) { // Map<String, dynamic> doctorInfo = document.data() as Map<String, dynamic>; Widget doctorCard(Size size, Map<String,dynamic> doctorInfo, BuildContext context) { // Map<String, dynamic> doctorInfo = document.data() as Map<String, dynamic>; return Column( children: [ GestureDetector( onTap: () { Navigator.of(context).push(MaterialPageRoute( builder: (context) => AppointmentBookingPage( size: size, name: doctorInfo['name'], pfpLink: doctorInfo['photoURL'], address: doctorInfo['address'], mail: doctorInfo['email'], phoneNumber: doctorInfo['number'], bio: doctorInfo['bio'], exp: doctorInfo['age'], close: getDateTimeText( (doctorInfo['close'] as Timestamp).toDate()), specialization: doctorInfo['specialization'], open: getDateTimeText( (doctorInfo['open'] as Timestamp).toDate()), qualification: doctorInfo['qualification'], doctorUID: doctorInfo['uid'], doctorInfo: doctorInfo, ))); }, child: Card( elevation: 10.0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), color: maingreen, child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( " ${doctorInfo['name']}", style: TextStyle( fontSize: size.width / 20, fontWeight: FontWeight.bold, fontFamily: 'Dosis-Bold', color: Colors.black), ), Padding( padding: const EdgeInsets.only(right: 8), child: Container( decoration: const BoxDecoration( shape: BoxShape.rectangle, color: Colors.white), child: Text( doctorInfo['age'] + "yr Exp.", style: TextStyle(fontSize: size.width / 30), ), ), ), ], ), Row( children: [ Padding( padding: const EdgeInsets.only(left: 8), child: Text( "Specializations : ", style: TextStyle( fontSize: size.width / 25, fontWeight: FontWeight.w500, fontFamily: 'Dosis-Regular', ), )), Text(doctorInfo['specialization'].toString(), style: TextStyle( fontSize: size.width / 25, fontWeight: FontWeight.w400)), ], ), Row( children: [ Padding( padding: const EdgeInsets.only(left: 8), child: Text( "Address : ", style: TextStyle( fontSize: size.width / 25, fontWeight: FontWeight.w500), )), Column( children: [ DoctorAddress( address: doctorInfo['address'].toString(), size: size), ], ), ], ), Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ const SizedBox( height: 4, ), Container( color: mainwhite, child: Column( children: [ Padding( padding: const EdgeInsets.only(left: 8), child: Row( children: [ Text( "OPEN: ", style: TextStyle( fontSize: size.width / 30, fontWeight: FontWeight.w500), ), DoctorAddress( address: getDateTimeText( (doctorInfo['open'] as Timestamp) .toDate()), size: size), ], ), ), Padding( padding: const EdgeInsets.only(left:8.0,bottom: 4), child: Row( children: [ //DoctorAddress(address: "CLOSE : ", size: size), Text( "CLOSE: ", style: TextStyle( fontSize: size.width / 30, fontWeight: FontWeight.w500), ), DoctorAddress( address: getDateTimeText( (doctorInfo['close'] as Timestamp) .toDate()), size: size), ], ), ), ], ), ), ], ), ], ), ), ), SizedBox( height: size.height * 0.02, ) ], ); }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/appointmenthistorywidget.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/gettime.dart'; Widget appointmentHistoryTile(DocumentSnapshot document) { Map<String, dynamic> doc = (document.data() as Map<String, dynamic>); return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) => Padding( padding: const EdgeInsets.all(8), child: Container( width: constraints.maxWidth, decoration: BoxDecoration( shape: BoxShape.rectangle, color: maingreen, borderRadius: BorderRadius.circular(5)), child: Padding( padding: const EdgeInsets.all(8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // SizedBox(height: constraints.maxHeight*0.02,), Text( doc['name'], style: TextStyle( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.045), ), //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Text( "Booking Status : 'Booked/Attended/Missed'", style: TextStyle( color: Colors.black45, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), ), //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Text( "Booked on : ${getDateTimeText((doc['booking time'] as Timestamp).toDate())}", style: TextStyle( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), ), RichText( text: TextSpan( text: "Address : ${doc['address']}", style: TextStyle( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), )), Row( children: [ Text( "Check Report : ", style: TextStyle( fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), ), CupertinoButton(child: const Text("Click Here"), onPressed: () {}) ], ) ], ), ), ), ), ); }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/sidebar.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:swasthya_setu/providers/details.dart'; import 'package:swasthya_setu/user_pages/user_home_page.dart'; import 'package:swasthya_setu/user_pages/user_profile.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/drawer_item.dart'; import '../pages/historyappointments.dart'; import '../user_pages/user_report_page.dart'; class Sidebar extends StatefulWidget { final Size size; final String userid; const Sidebar({Key? key, required this.size,required this.userid}) : super(key: key); @override // ignore: library_private_types_in_public_api _SidebarState createState() => _SidebarState(); } class _SidebarState extends State<Sidebar> { @override void initState() { super.initState(); context.read<UserDetailsProvider>().getUserdetails(); } @override Widget build(BuildContext context) { Map<String, dynamic> userDetailsMap = Provider.of<UserDetailsProvider>(context, listen: true) .getUserDetailsMap; return Drawer( child: Material( color: mainwhite, child: Padding( padding: const EdgeInsets.fromLTRB(15.0, 30, 24, 0), child: Column( children: [ headerWidget(userDetailsMap,widget.size), const SizedBox(height: 10), const Divider(thickness: 1, height: 2, color: Colors.green), const SizedBox(height: 20), DrawerItem( name: 'Dashboard', icon: Icons.dashboard_outlined, onPressed: () => onItemPressed(context, index: 0), ), const SizedBox(height: 30), DrawerItem( name: 'Reports', icon: Icons.receipt, onPressed: () => onItemPressed(context, index: 1), ), const SizedBox(height: 30), DrawerItem( name: 'Appointments', icon: Icons.calendar_month, onPressed: () => onItemPressed(context, index: 2), ), ], ), ), ), ); } Widget headerWidget(Map<String, dynamic> userDetailsMap,Size size) { return GestureDetector(onTap: () { Navigator.of(context).push(MaterialPageRoute( builder: ((context) => UserProfilePage( size: widget.size, name: userDetailsMap['name'], number: userDetailsMap['number'], age: userDetailsMap['age'], image: userDetailsMap['photoURL'], gender: userDetailsMap['gender'], mail: userDetailsMap['email'], address: userDetailsMap['address'], )), )); }, child: Column( children: [ CircleAvatar( backgroundImage: NetworkImage("${userDetailsMap['photoURL']}"), radius: size.width*0.2, ), const SizedBox(width: 30), Text( "${userDetailsMap['name']}", style: const TextStyle(color: Colors.black, fontSize: 30,fontWeight: FontWeight.w600), ), ], ), ); } void onItemPressed(BuildContext context, {required int index}) { Navigator.pop(context); switch (index) { case 0: Navigator.push( context, MaterialPageRoute( builder: (context) => UserHomePage(size: widget.size))); break; case 1: Navigator.push( context, MaterialPageRoute( builder: (context) => const UserReportPage())); break; case 2: Navigator.push( context, MaterialPageRoute( builder: (context) => AppointmentHistory(userUid: widget.userid,))); break; default: Navigator.pop(context); break; } } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/textwidget.dart
import 'package:flutter/material.dart'; class DoctorAddress extends StatelessWidget { final String address; final Size size; const DoctorAddress({super.key, required this.address, required this.size}); @override Widget build(BuildContext context) { return Column( children: [ Text(address, maxLines: 2, softWrap: true, // overflow: TextOverflow.fade, style: TextStyle( fontSize: size.width / 30, fontWeight: FontWeight.w500)), ], ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/attendedpatient_tile.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:swasthya_setu/pages/report_view.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/gettime.dart'; Widget patientTile(DocumentSnapshot document, Size size) { Map<String, dynamic> doc = (document.data() as Map<String, dynamic>); return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) => Padding( padding: const EdgeInsets.all(8), child: Container( width: constraints.maxWidth, decoration: BoxDecoration( shape: BoxShape.rectangle, color: maingreen, borderRadius: BorderRadius.circular(5)), child: Padding( padding: const EdgeInsets.all(8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // SizedBox(height: constraints.maxHeight*0.02,), Text( doc['name'], style: TextStyle( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.045), ), //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Text( "Attended on : ${getDateTimeText((doc["attentedAt"] as Timestamp).toDate())}", style: TextStyle( color: Colors.black45, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), ), //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Text( "Booked on : ${getDateTimeText((doc['booking time'] as Timestamp).toDate())}", style: TextStyle( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), ), RichText( text: TextSpan( text: "Address : ${doc['address']}", style: TextStyle( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), )), Row( children: [ Text( "Check Report Details : ", style: TextStyle( fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), ), CupertinoButton( child: const Text("Click Here"), onPressed: () { Navigator.of(context).push(MaterialPageRoute( builder: (context) => WriteReportView( patientMap: doc, ))); }) ], ) ], ), ), ), ), ); }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/bulletin.dart
import 'package:flutter/material.dart'; class Bulletin extends StatelessWidget { final String value; final Size size; const Bulletin({super.key, required this.value, required this.size}); @override Widget build(BuildContext context) { return Row( children: [ const Icon(Icons.circle_rounded,color: Colors.black87,), SizedBox(width: size.width*0.03,), Text( value, style: TextStyle( fontSize: size.height * 0.02, fontWeight: FontWeight.w500), ) ], ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/active_doctors.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:swasthya_setu/backend/appointment.dart'; import 'package:swasthya_setu/widgets/doctorcard.dart'; List<Map<String, dynamic>> searchedListByUser = [{}]; class ActiveDoctorList extends StatelessWidget { final Size size; const ActiveDoctorList({super.key, required this.size}); @override Widget build(BuildContext context) { return StreamBuilder( stream: activeDoctors(), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot<Object?>> snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return const Center( child: Text("Loading...\nNetwork is Slow"), ); } else if (snapshot.hasData) { // print("*******"); // print(snapshot.data!.docs // .map((document) => (document.data() as Map<String,dynamic>)) // .toList()); // print("*******"); List<Map<String, dynamic>> allDoctors = snapshot.data!.docs .map((document) => (document.data() as Map<String, dynamic>)) .toList(); searchedListByUser = allDoctors; return ListView.builder( itemCount: snapshot.data!.size, itemBuilder: (context, int index) { return snapshot.data!.docs .map((document) => doctorCard(size, searchedListByUser[index], context)) .toList()[index]; }); } else if (snapshot.hasError) { return Center( child: SizedBox( width: 100, height: 100, child: Text("Error Occurred\n${snapshot.error}"), ), ); } return const Center( child: SizedBox( height: 150, width: 150, child: CircularProgressIndicator(), ), ); }, ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/widgets/addresswidget.dart
import 'package:flutter/material.dart'; import 'package:swasthya_setu/utils/getlocation.dart'; class AddressText extends StatefulWidget { const AddressText({super.key}); @override State<AddressText> createState() => _AddressTextState(); } class _AddressTextState extends State<AddressText> { String _location = "Loading..."; getAddress(BuildContext context) async { _location = await getLocation(); if (_location.substring(0, 9) == "Throttled") { _location = "Please Refresh "; } setState(() {}); } @override void initState() { super.initState(); getAddress(context); } @override Widget build(BuildContext context) { return Column(mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: 30, child: ElevatedButton( style: ElevatedButton.styleFrom(shape: const BeveledRectangleBorder()), onPressed: () async { // String add = await getLocation(); _location = await getLocation(); if (_location.substring(0, 9) == "Throttled") { _location = "Please Refresh "; } // print(_location); setState(() { }); }, child: const Text("Locate Again", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 15, fontFamily: 'DosisRegular', color: Colors.cyan))), ), const SizedBox(height: 8,), Center( child: Container( decoration: BoxDecoration(borderRadius: BorderRadius.circular(4),color: Colors.green.shade100), child: Text( " $_location ", textAlign: TextAlign.center, softWrap: true, style: const TextStyle(color: Colors.black, fontSize: 15), ), ), ) ]); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/pages/historyappointments.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:swasthya_setu/backend/appointment.dart'; import 'package:swasthya_setu/widgets/appointmenthistorywidget.dart'; class AppointmentHistory extends StatelessWidget { final String userUid; const AppointmentHistory({super.key, required this.userUid}); @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( appBar: AppBar( title: const Text( "Appointments", style: TextStyle(fontWeight: FontWeight.bold), ), ), body: StreamBuilder( stream: userAppointmentsHistory(userUid), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot<Object?>> snapshot) { if (snapshot.hasError) { return const Center( child: Text("Some Error Occurred , Please try after some time")); } else if (snapshot.connectionState == ConnectionState.waiting) { return const Center( child: Text("Loading..."), ); }else{ return ListView.builder( itemCount: snapshot.data!.size, itemBuilder: (context, int index) { return snapshot.data!.docs .map((document) => appointmentHistoryTile(document)) .toList()[index]; }); } }, ), )); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/pages/bookingpage.dart
import 'package:flutter/material.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; import 'package:swasthya_setu/backend/appointment.dart'; import 'package:swasthya_setu/providers/details.dart'; import 'package:swasthya_setu/utils/callfunc.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/widgets/bulletin.dart'; import 'package:swasthya_setu/widgets/contacts.dart'; import 'package:swasthya_setu/widgets/textwidget.dart'; class AppointmentBookingPage extends StatelessWidget { final Size size; final String name; final String pfpLink; final String address; final String mail; final String phoneNumber; final String bio; final String exp; final String close; final String open; final List specialization; final String doctorUID; final String qualification; final Map<String, dynamic> doctorInfo; const AppointmentBookingPage( {super.key, required this.size, required this.name, required this.pfpLink, required this.address, required this.mail, required this.phoneNumber, required this.bio, required this.exp, required this.close, required this.open, required this.specialization, required this.qualification, required this.doctorUID, required this.doctorInfo}); @override Widget build(BuildContext context) { Map<String, dynamic> userDetailsMap = Provider.of<UserDetailsProvider>(context, listen: true) .getUserDetailsMap; return SafeArea( child: Scaffold( backgroundColor: Colors.green.shade50, body: Padding( padding: const EdgeInsets.all(8), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ GestureDetector( onTap: () { Navigator.of(context).pop(); }, child: Icon( Icons.chevron_left_rounded, size: size.width * 0.09, )), Center( child: CircleAvatar( backgroundImage: NetworkImage(pfpLink), radius: size.width / 4, ), ), SizedBox( height: size.height * 0.02, ), Text(name, style: TextStyle( fontWeight: FontWeight.w600, fontSize: size.height * 0.05)), Text("$exp yr Exp. || $qualification || $bio"), SizedBox( height: size.height * 0.03, ), Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Container( color: Colors.orange.shade100, child: Row( children: [ DoctorAddress(address: "OPEN : ", size: size), DoctorAddress(address: open, size: size), ], ), ), ]), Container( color: Colors.orange.shade200, child: Row( children: [ DoctorAddress(address: "CLOSE : ", size: size), DoctorAddress(address: close, size: size), ], ), ), SizedBox( height: size.height * 0.01, ), Container( color: Colors.green.shade100, child: Text( " SPECIALIZATION ", style: TextStyle( fontSize: size.height * 0.02, fontWeight: FontWeight.w500), )), SizedBox( height: size.height * 0.02, ), for (int i = 0; i < specialization.length; i++) Bulletin(value: specialization[i].toString(), size: size), SizedBox( height: size.height * 0.02, ), Container( color: Colors.green.shade100, child: Text( " Contacts ", style: TextStyle( fontSize: size.height * 0.02, fontWeight: FontWeight.w500), )), SizedBox( height: size.height * 0.02, ), Column( children: [ Contacts( icon: Icons.mail, value: mail, size: size, ), SizedBox( height: size.height * 0.01, ), GestureDetector( onTap: () { makePhoneCall(phoneNumber); }, child: Contacts( icon: Icons.phone, value: phoneNumber, size: size, ), ), ], ), SizedBox( height: size.height * 0.03, ), Container( color: Colors.green.shade100, child: Text( " ADDRESS ", style: TextStyle( fontSize: size.height * 0.02, fontWeight: FontWeight.w500), )), SizedBox( height: size.height * 0.02, ), GestureDetector( onTap: () { MapsLauncher.launchQuery(address); }, child: Contacts( icon: Icons.pin_drop_sharp, value: address, size: size), ), SizedBox( height: size.height * 0.02, ), Align( alignment: AlignmentDirectional.bottomCenter, child: ElevatedButton.icon( style: ElevatedButton.styleFrom( backgroundColor: maingreen, fixedSize: Size(double.infinity, size.height * 0.07)), onPressed: () async { await bookAppointment( doctorUID, userDetailsMap['uid'], userDetailsMap, context, doctorInfo); }, icon: Icon( Icons.handshake, color: Colors.black, size: size.height * 0.03, ), label: Text( "Book Appointment", style: TextStyle( color: Colors.black, fontSize: size.height * 0.02), ))) ], ), ), ), ), ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/pages/signin_as_user.dart
import 'dart:typed_data'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; import 'package:swasthya_setu/backend/authorization.dart'; import 'package:swasthya_setu/get_image/getimage.dart'; import 'package:swasthya_setu/pages/loginpage.dart'; import 'package:swasthya_setu/utils/colours.dart'; // import 'package:swasthya_setu/utils/customcheckbox.dart'; import 'package:swasthya_setu/utils/customtextfield.dart'; import 'package:swasthya_setu/utils/toast.dart'; class SigninUserPage extends StatefulWidget { final Size size; const SigninUserPage({super.key, required this.size}); @override State<SigninUserPage> createState() => _SigninUserPageState(); } class _SigninUserPageState extends State<SigninUserPage> { TextEditingController _getName = TextEditingController(); TextEditingController _getAge = TextEditingController(); TextEditingController _getNumber = TextEditingController(); TextEditingController _getEmail = TextEditingController(); TextEditingController _getAddress = TextEditingController(); TextEditingController _getPassword = TextEditingController(); static List<String> item = ["Male", "Female"]; bool? pediatrician = false; bool? neurologist = false; bool? cardiologist = false; bool? dermatologist = false; bool? dentist = false; bool? physician = false; bool? ent = false; String? dropDownvalue = item.first; Uint8List? _imagedp; @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( backgroundColor: const Color.fromARGB(255, 199, 215, 180), //backgroundColor: Colors.white, body: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return Center( child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ SizedBox( height: constraints.maxHeight * 0.02, ), GestureDetector( onTap: () { Navigator.of(context).push( MaterialPageRoute(builder: (context) => LoginPage())); }, child: const Text( "Already Have an Account? Click Here", style: TextStyle( color: maingreen, fontSize: 20, fontFamily: 'Dosis-Regular'), ), ), SizedBox( height: constraints.maxHeight * 0.02, ), Stack(children: [ _imagedp != null ? CircleAvatar( backgroundImage: MemoryImage(_imagedp!), radius: constraints.maxHeight * 0.1, ) : CircleAvatar( backgroundImage: const AssetImage("assets/dp.jpg"), radius: constraints.maxHeight * 0.1, ), Positioned( bottom: constraints.maxHeight * 0.01, right: constraints.maxWidth * 0.02, child: IconButton( icon: Icon(Icons.add_a_photo, size: constraints.maxHeight * 0.05), onPressed: () async { Uint8List dp = await getImage(ImageSource.gallery); _imagedp = dp; setState(() {}); }, ), ), ]), Expanded( child: ListView( children: [ SizedBox( height: constraints.maxHeight * 0.05, ), getTextField( "Name", constraints.maxHeight * 0.05, _getName), SizedBox( height: constraints.maxHeight * 0.05, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded( child: getTextNumberField( "Age", constraints.maxHeight * 0.05, TextInputType.number, _getAge), ), SizedBox( width: constraints.maxWidth * 0.09, ), Expanded( child: DropdownButton<String>( autofocus: true, focusColor: Colors.grey.shade200, dropdownColor: Colors.grey.shade200, value: dropDownvalue, items: item.map((String value) { return DropdownMenuItem( child: Text("$value"), value: value, ); }).toList(), onChanged: (String? value) { setState(() { dropDownvalue = value; }); })) ], ), SizedBox( height: constraints.maxHeight * 0.05, ), getTextField("Phone Number", constraints.maxHeight * 0.05, _getNumber), SizedBox( height: constraints.maxHeight * 0.05, ), getTextField("Email Address", constraints.maxHeight * 0.05, _getEmail), SizedBox( height: constraints.maxHeight * 0.05, ), getTextField("Password", constraints.maxHeight * 0.05, _getPassword), SizedBox( height: constraints.maxHeight * 0.05, ), Text( "Residential Address", style: TextStyle( fontWeight: FontWeight.w500, fontSize: constraints.maxHeight * 0.03), ), getTextField( "", constraints.maxHeight * 0.07, _getAddress), SizedBox( height: constraints.maxHeight * 0.05, ), CupertinoButton( onPressed: () { if (_getAddress.text.isEmpty || _imagedp == null || _getAge.text.isEmpty || _getEmail.text.isEmpty || _getPassword.text.isEmpty) { getScaffold("Some Enteries are not filled", context, Colors.red); } else { Uint8List image = _imagedp!; UserAuthorization( FirebaseAuth.instance, "null by me", _getAge.text.trim(), _getAddress.text, _getEmail.text.trim(), "null by me", _getName.text.trim(), dropDownvalue!, _getPassword.text.trim(), context, widget.size, _getNumber.text) .signUpWithEmail(image); } }, color: maingreen, child: const Text( "Sign Up", style: TextStyle(color: Colors.white), ), ), ], ), ), ], ), ), ); }), )); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/pages/report_view.dart
import 'package:flutter/material.dart'; import 'package:swasthya_setu/utils/colours.dart'; class WriteReportView extends StatelessWidget { final Map<String, dynamic> patientMap; const WriteReportView({super.key, required this.patientMap}); @override Widget build(BuildContext context) { TextEditingController _getReport = TextEditingController(); TextEditingController _getMedicine = TextEditingController(); TextEditingController _getTest = TextEditingController(); TextEditingController _getPrecaution = TextEditingController(); _getMedicine.text = patientMap["medicine"]; _getPrecaution.text = patientMap["precaution"]; _getReport.text = patientMap["report"]; _getTest.text = patientMap["test"]; Size size = MediaQuery.of(context).size; return SafeArea( child: Scaffold( appBar: AppBar( title: const Row( children: [ Icon( Icons.pending_actions, color: Colors.white, weight: 8, size: 40, ), SizedBox( width: 5, ), Text( "Report", style: TextStyle( color: Colors.white, fontWeight: FontWeight.w600, fontSize: 30, fontFamily: 'Dosis', ), ), ], ), centerTitle: true, backgroundColor: maingreen, ), body: Padding( padding: const EdgeInsets.all(8.0), child: ListView(children: [ const SizedBox( height: 10, ), Text( "Report/Comments", style: TextStyle( color: Colors.black, fontWeight: FontWeight.w600, fontSize: size.height * 0.035, fontFamily: 'Dosis', ), ), const SizedBox( height: 10, ), SizedBox( width: double.infinity, child: TextField( readOnly: true, autofocus: true, controller: _getReport, maxLines: 8, keyboardType: TextInputType.multiline, // this is change textInputAction: TextInputAction.newline, // this is change decoration: const InputDecoration( focusedBorder: OutlineInputBorder(), enabledBorder: OutlineInputBorder(), hintStyle: TextStyle(fontSize: 14, color: Colors.black), ), ), ), const SizedBox( height: 10, ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ SizedBox( width: size.width * 0.45, child: Column( children: [ Text( "Medicine(s)", style: TextStyle( color: Colors.black, fontWeight: FontWeight.w600, fontSize: size.height * 0.035, fontFamily: 'Dosis', ), ), SizedBox( child: TextField( readOnly: true, autofocus: true, controller: _getMedicine, maxLines: 8, keyboardType: TextInputType.multiline, // this is change textInputAction: TextInputAction.newline, // this is change decoration: const InputDecoration( focusedBorder: OutlineInputBorder(), enabledBorder: OutlineInputBorder(), hintStyle: TextStyle(fontSize: 14, color: Colors.black), ), ), ), ], ), ), SizedBox( width: size.width * 0.35, child: Column( children: [ Text( "Test(s)", style: TextStyle( color: Colors.black, fontWeight: FontWeight.w600, fontSize: size.height * 0.035, fontFamily: 'Dosis', ), ), SizedBox( child: TextField( readOnly: true, autofocus: true, controller: _getTest, maxLines: 8, keyboardType: TextInputType.multiline, // this is change textInputAction: TextInputAction.newline, // this is change decoration: const InputDecoration( focusedBorder: OutlineInputBorder(), enabledBorder: OutlineInputBorder(), hintStyle: TextStyle(fontSize: 14, color: Colors.black), ), ), ), ], ), ), ], ), Text( "Precaution(s)", style: TextStyle( color: Colors.black, fontWeight: FontWeight.w600, fontSize: size.height * 0.035, fontFamily: 'Dosis', ), ), const SizedBox( height: 10, ), SizedBox( width: double.infinity, child: TextField( readOnly: true, autofocus: true, controller: _getPrecaution, maxLines: 2, keyboardType: TextInputType.multiline, // this is change textInputAction: TextInputAction.newline, // this is change decoration: const InputDecoration( focusedBorder: OutlineInputBorder(), enabledBorder: OutlineInputBorder(), hintStyle: TextStyle(fontSize: 14, color: Colors.black), ), ), ), ]), ), )); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/pages/signinoption_page.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:lottie/lottie.dart'; import 'package:swasthya_setu/pages/signin_as_doctor.dart'; import 'package:swasthya_setu/pages/signin_as_user.dart'; import 'package:swasthya_setu/utils/colours.dart'; class SignInOptionPage extends StatelessWidget { const SignInOptionPage({super.key}); @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return SafeArea( child: Scaffold( backgroundColor: maingreen, /*appBar: AppBar( centerTitle: true, backgroundColor: maingreen, title: Text( "Swasthya Setu", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontFamily: 'Dosis-Bold', fontSize: size.height * 0.05), ), ),*/ body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text("Swasthya Setu",style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontFamily: 'Dosis-Bold', fontSize: size.height * 0.05), ), Center( child: Lottie.asset("assets/medical.json"), ), CupertinoButton( onPressed: () { Navigator.of(context).push(MaterialPageRoute( builder: (context) => SigninDoctorPage(size: size,))); }, color: mainwhite, child: const Text( "I'm Doctor", style: TextStyle(color: maingreen,fontSize: 30), ), ), SizedBox( height: size.height * 0.05, ), CupertinoButton( onPressed: () { Navigator.of(context).push(MaterialPageRoute( builder: (context) => SigninUserPage(size: size))); }, color: mainwhite, child: const Text( "I'm User ", style: TextStyle(color: maingreen,fontSize: 30,fontFamily: 'Dosis-Bold'), ), ), ], ), )), ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/pages/loginpage.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:lottie/lottie.dart'; import 'package:swasthya_setu/backend/authorization.dart'; import 'package:swasthya_setu/doctor_pages/doctor_home_page.dart'; import 'package:swasthya_setu/user_pages/user_home_page.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/customtextfield.dart'; import 'package:swasthya_setu/utils/toast.dart'; class LoginPage extends StatefulWidget { const LoginPage({super.key}); @override State<LoginPage> createState() => _LoginPageState(); } class _LoginPageState extends State<LoginPage> { TextEditingController _getEmail = TextEditingController(); TextEditingController _getPassword = TextEditingController(); @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return SafeArea( child: Scaffold( appBar: AppBar( centerTitle: true, backgroundColor: maingreen, title: Text( "Swasthya Setu", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: size.height * 0.05), ), ), backgroundColor: const Color.fromARGB(255, 199, 215, 180), //backgroundColor: Colors.teal, body: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return Center( child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Center( child: Lottie.asset("assets/medical.json"), ), SizedBox( height: constraints.maxHeight * 0.02, ), Expanded( child: ListView( children: [ SizedBox( height: constraints.maxHeight * 0.05, ), getTextField("Email Address", constraints.maxHeight * 0.05, _getEmail), SizedBox( height: constraints.maxHeight * 0.05, ), getTextField("Password", constraints.maxHeight * 0.05, _getPassword), SizedBox( height: constraints.maxHeight * 0.05, ), SizedBox( height: constraints.maxHeight * 0.05, ), CupertinoButton( onPressed: () async { if (_getEmail.text.isEmpty || _getPassword.text.isEmpty) { getScaffold("Some Enteries are not filled", context, Colors.red); } else { String? isLoggedin = await LoginMethod( context, FirebaseAuth.instance) .loginUser(_getEmail.text.trim(), _getPassword.text.trim()); if (isLoggedin == "User") { //! get type if type==user then show user ui otherwise show doctor ui Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( builder: (context) => UserHomePage(size: size)),(Route<dynamic> route) => false); } else if (isLoggedin == "Doctor") { Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( builder: (context) => DoctorHomePage(size: size)),(Route<dynamic> route) => false); } } }, color: maingreen, child: const Text("Login",style: TextStyle(fontSize: 20),), ), ], ), ), ], ), ), ); }), )); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/pages/signin_as_doctor.dart
import 'dart:typed_data'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; import 'package:swasthya_setu/backend/authorization.dart'; import 'package:swasthya_setu/get_image/getimage.dart'; import 'package:swasthya_setu/pages/loginpage.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/customcheckbox.dart'; import 'package:swasthya_setu/utils/customtextfield.dart'; import 'package:swasthya_setu/utils/toast.dart'; class SigninDoctorPage extends StatefulWidget { final Size size; const SigninDoctorPage({super.key, required this.size}); @override State<SigninDoctorPage> createState() => _SigninDoctorPageState(); } class _SigninDoctorPageState extends State<SigninDoctorPage> { TextEditingController _getName = TextEditingController(); TextEditingController _getQualification = TextEditingController(); TextEditingController _getBio = TextEditingController(); TextEditingController _getAge = TextEditingController(); TextEditingController _getNumber = TextEditingController(); TextEditingController _getEmail = TextEditingController(); TextEditingController _getAddress = TextEditingController(); TextEditingController _getPassword = TextEditingController(); static List<String> item = ["Male", "Female"]; bool? pediatrician = false; bool? neurologist = false; bool? cardiologist = false; bool? dermatologist = false; bool? dentist = false; bool? physician = false; bool? homeopathy = false; bool? alopathy = false; bool? ayurved = false; bool? ent = false; String? dropDownvalue = item.first; Uint8List? _imagedp; @override Widget build(BuildContext context) { List<String> specializations = []; return SafeArea( child: Scaffold( backgroundColor: const Color.fromARGB(255, 199, 215, 180), body: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return Center( child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ SizedBox( height: constraints.maxHeight * 0.02, ), GestureDetector( onTap: () { Navigator.of(context).push( MaterialPageRoute(builder: (context) => LoginPage())); }, child: const Text( "Already Have Account? Click Here", style: TextStyle(color: maingreen,fontSize: 20,fontFamily: 'Dosis-Regular'), )), SizedBox( height: constraints.maxHeight * 0.02, ), Stack(children: [ _imagedp != null ? CircleAvatar( backgroundImage: MemoryImage(_imagedp!), radius: constraints.maxHeight * 0.1, ) : CircleAvatar( backgroundImage: const AssetImage("assets/dp.jpg"), radius: constraints.maxHeight * 0.1, ), Positioned( bottom: constraints.maxHeight * 0.01, right: constraints.maxWidth * 0.02, child: IconButton( icon: Icon(Icons.add_a_photo, size: constraints.maxHeight * 0.05), onPressed: () async { Uint8List dp = await getImage(ImageSource.gallery); _imagedp = dp; setState(() {}); }, ), ), ]), Expanded( child: ListView( children: [ SizedBox( height: constraints.maxHeight * 0.05, ), getTextField( "Name", constraints.maxHeight * 0.05, _getName), SizedBox( height: constraints.maxHeight * 0.05, ), getTextField("Qualification", constraints.maxHeight * 0.05, _getQualification), SizedBox( height: constraints.maxHeight * 0.05, ), getTextField( "Bio", constraints.maxHeight * 0.05, _getBio), SizedBox( height: constraints.maxHeight * 0.05, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded( child: getTextNumberField( "Exp.", constraints.maxHeight * 0.05, TextInputType.number, _getAge), ), SizedBox( width: constraints.maxWidth * 0.09, ), Expanded( child: DropdownButton<String>( autofocus: true, focusColor: Colors.grey.shade200, dropdownColor: Colors.grey.shade200, value: dropDownvalue, items: item.map((String value) { return DropdownMenuItem( value: value, child: Text(value), ); }).toList(), onChanged: (String? value) { setState(() { dropDownvalue = value; }); })) ], ), SizedBox( height: constraints.maxHeight * 0.05, ), getTextField("Phone Number", constraints.maxHeight * 0.05, _getNumber), SizedBox( height: constraints.maxHeight * 0.05, ), getTextField("Email Address", constraints.maxHeight * 0.05, _getEmail), SizedBox( height: constraints.maxHeight * 0.05, ), Text( "SELECT YOUR SPECIALIZATION", style: TextStyle( fontWeight: FontWeight.w600, fontSize: constraints.maxHeight * 0.05), ), Column( children: [ Row( children: [ GetCheckBox(isName: ent, name: "ENT", specializations: specializations,), GetCheckBox(isName: physician, name: "Physician", specializations: specializations), GetCheckBox(isName: dentist, name: "Dentist", specializations: specializations), ], ), Row( children: [ GetCheckBox( isName: pediatrician, name: "Pediatrician", specializations: specializations), GetCheckBox( isName: cardiologist, name: "Cardiologist", specializations: specializations), ], ), Row( children: [ GetCheckBox( isName: neurologist, name: "Neurologist", specializations: specializations), GetCheckBox( isName: dentist, name: "Dermatologist", specializations: specializations), ], ), Row( children: [ GetCheckBox( isName: homeopathy, name: "Homeopathy", specializations: specializations), GetCheckBox(isName: alopathy, name: "Alopathy", specializations: specializations), GetCheckBox(isName: ayurved, name: "Ayurvedic", specializations: specializations), ], ), ], ), SizedBox( height: constraints.maxHeight * 0.05, ), Text( "Clinic/Hospital Address", style: TextStyle( fontWeight: FontWeight.w500, fontSize: constraints.maxHeight * 0.03), ), getTextField( "", constraints.maxHeight * 0.07, _getAddress), SizedBox( height: constraints.maxHeight * 0.05, ), getTextField("Password", constraints.maxHeight * 0.05, _getPassword), SizedBox( height: constraints.maxHeight * 0.05, ), CupertinoButton( onPressed: () { if (_getAddress.text.isEmpty || _imagedp == null || _getAge.text.isEmpty || _getEmail.text.isEmpty || _getPassword.text.isEmpty || _getQualification.text.isEmpty || specializations.isEmpty) { getScaffold("Some Enteries are not filled", context, Colors.red); } else { Uint8List image = _imagedp!; Authorization( FirebaseAuth.instance, "null by me", _getAge.text.trim(), _getAddress.text, _getEmail.text.trim(), "null by me", _getName.text.trim(), dropDownvalue!, _getBio.text, _getQualification.text, _getPassword.text.trim(), specializations, context, widget.size,_getNumber.text) .signUpWithEmail(image); } }, color: maingreen, child: const Text("Sign Up"), ), ], ), ), ], ), ), ); }), )); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/models/chatmodel.dart
import 'package:flutter/material.dart'; import 'package:swasthya_setu/utils/colours.dart'; List<Map<String, String>> chatDetails = [ {'user': 'bot', 'message': 'Hello , You can ask your query here . '}, ]; Widget getChat(String user, String message) { return user == "bot" ? Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: maingreen, ), child: Padding( padding: const EdgeInsets.only(bottom: 8.0, top: 8.0), child: Text( message, style: const TextStyle(color: Colors.white), ), ), ) : Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: maingreen, ), child: Padding( padding: const EdgeInsets.only(bottom: 8.0, top: 8), child: Text( message, style: const TextStyle(color: Colors.white), ), ), ); } class Chat extends StatelessWidget { final constraints; final content; const Chat({super.key, required this.constraints, required this.content}); @override Widget build(BuildContext context) { return Align( alignment: content['user'].toString() == "bot" ? Alignment.bottomLeft : Alignment.bottomRight, child: Column( children: [ SizedBox( height: 5, ), getChat("${content['user']}", " ${content['message']} "), SizedBox( height: 5, ), ], )); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/get_image/getimage.dart
import 'package:image_picker/image_picker.dart'; getImage(ImageSource source) async { final ImagePicker picker = ImagePicker(); // Pick an image. final XFile? image = await picker.pickImage(source: ImageSource.gallery); if (image != null) { return image.readAsBytes(); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/doctor_pages/doctor_home_page.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:omni_datetime_picker/omni_datetime_picker.dart'; import 'package:provider/provider.dart'; import 'package:swasthya_setu/backend/appointment.dart'; import 'package:swasthya_setu/doctor_pages/scheduledappointments.dart'; import 'package:swasthya_setu/providers/details.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/customcheckbox.dart'; import 'package:swasthya_setu/utils/gettime.dart'; import 'package:swasthya_setu/widgets/sidebar_doctor.dart'; class DoctorHomePage extends StatefulWidget { final Size size; const DoctorHomePage({super.key, required this.size}); @override State<DoctorHomePage> createState() => _DoctorHomePageState(); } bool? isLive = false; class _DoctorHomePageState extends State<DoctorHomePage> { @override void initState() { super.initState(); context.read<DoctorDetailsProvider>().getDoctordetails(); } DateTime opendatetime = DateTime.now(); DateTime closedatetime = DateTime.now(); String open = "Nill"; String close = "Nill"; @override Widget build(BuildContext context) { Map<String, dynamic> userDetailsMap = Provider.of<DoctorDetailsProvider>(context, listen: true) .getDoctorDetailsMap; String message = "Your Clinic/Hospital is CLOSE Currently"; if (open == userDetailsMap['open']) { } else if (userDetailsMap['open'] is Timestamp) { open = getDateTimeText((userDetailsMap['open'] as Timestamp).toDate()); close = getDateTimeText((userDetailsMap['close'] as Timestamp).toDate()); (DateTime.now().compareTo( (userDetailsMap['close'] as Timestamp).toDate()) == -1 && (DateTime.now().compareTo( (userDetailsMap['open'] as Timestamp).toDate())) == 1) ? message = "Your Clinic/Hospital is Live" : message = "Your Clinic/Hospital is CLOSE Currently"; } else { open = getDateTimeText(userDetailsMap['open']); close = getDateTimeText(userDetailsMap['close']); (DateTime.now().compareTo((userDetailsMap['open'] as DateTime)) == 1 && DateTime.now().compareTo(userDetailsMap['close'] as DateTime) == -1) ? message = "Your Clinic/Hospital is Live" : message = "Your Clinic/Hospital is CLOSE Currently"; } return SafeArea( child: Scaffold( drawer: SidebarDoctor(size: widget.size), backgroundColor: Colors.white, appBar: AppBar( title: const Text( "Home Page", style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 30, fontFamily: 'Dosis', ), ), centerTitle: true, backgroundColor: maingreen, ), body: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ SizedBox( height: widget.size.height * 0.03, child: ElevatedButton( onPressed: () { setState(() {}); }, child: const Text("Refresh"), style: ElevatedButton.styleFrom(shape: const BeveledRectangleBorder()), ), ), SizedBox( height: widget.size.height * 0.1, width: double.maxFinite, child: Padding( padding: const EdgeInsets.all(5), child: Row( children: [ Column( children: [ /*IconButton( icon: CircleAvatar( backgroundImage: NetworkImage("${userDetailsMap['photoURL']}"), radius: widget.size.width * 0.2, ), onPressed: () { Navigator.of(context).push(MaterialPageRoute( builder: ((context) => DoctorProfilePage( size: widget.size, name: userDetailsMap['name'], number: userDetailsMap['number'], age: userDetailsMap['age'], image: userDetailsMap['photoURL'], gender: userDetailsMap['gender'], mail: userDetailsMap['email'], address: userDetailsMap['address'])))); }, ),*/ SizedBox( height: widget.size.height * 0.002, ), ], ), SizedBox( width: widget.size.width * 0.9, child: Column( children: [ /*Text( "${userDetailsMap['name']}", style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 30), softWrap: true, ),*/ /*Text( "${userDetailsMap['specialization']}", style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 12), ),*/ SizedBox( height: widget.size.height * 0.01, ), const Text( "Clinic Location", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 15), ), SizedBox( height: widget.size.height * 0.01, ), Text( "${userDetailsMap['address']}", style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 12), ), ], ), ) ], )), ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Card( color: maingreen, shape: const RoundedRectangleBorder(), child: SizedBox( height: widget.size.height * 0.05, // width: widget.size.width * 0.4, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon(Icons.library_books), Text( open, softWrap: true, style: TextStyle( fontSize: widget.size.width * 0.03, fontWeight: FontWeight.bold), ), ], ), ), ), Card( color: Colors.red, shape: const RoundedRectangleBorder(), child: SizedBox( height: widget.size.height * 0.05, // width: widget.size.width * 0.4, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon(Icons.apps_outage_outlined), Text( close, softWrap: true, style: TextStyle( fontSize: widget.size.width * 0.03, fontWeight: FontWeight.bold), ) ], ), ), ) ], ), Text( message, style: const TextStyle(color: Colors.blue), ), SingleChildScrollView( child: GestureDetector( onTap: () { DateTime? _opendateTime = opendatetime; DateTime? _closedateTime = closedatetime; showDialog( context: context, builder: (context) => AlertDialog( content: SizedBox( height: widget.size.height * 0.4, child: Column( children: [ Container( color: maingreen, child: Column( children: [ SizedBox( height: widget.size.height * 0.02, ), Text( "OPENING TIME :", style: TextStyle( fontSize: widget.size.width * 0.05), ), Padding( padding: const EdgeInsets.all(11), child: ElevatedButton( style: ElevatedButton.styleFrom( shape: const BeveledRectangleBorder()), onPressed: () async { _opendateTime = await showOmniDateTimePicker( context: context, initialDate: DateTime.now(), firstDate: DateTime(1600) .subtract(const Duration( days: 3652)), lastDate: DateTime.now().add( const Duration(days: 3652), ), is24HourMode: false, isShowSeconds: false, minutesInterval: 1, secondsInterval: 1, isForce2Digits: true, borderRadius: const BorderRadius.all( Radius.circular(16)), constraints: const BoxConstraints( maxWidth: 350, maxHeight: 650, ), transitionBuilder: (context, anim1, anim2, child) { return FadeTransition( opacity: anim1.drive( Tween( begin: 0, end: 1, ), ), child: child, ); }, transitionDuration: const Duration( milliseconds: 200), barrierDismissible: true, ); // print("dateTime: $_opendateTime"); }, child: const Text( "SET OPENING TIME"), ), // Text( "Date: ${_opendateTime!.day}/${_opendateTime!.month} Time: ${_opendateTime!.hour}:${_opendateTime!.minute}")), ) ], )), SizedBox( height: widget.size.height * 0.04, ), Container( color: Colors.orange, child: Column( children: [ SizedBox( height: widget.size.height * 0.02, ), Text( "CLOSING TIME :", style: TextStyle( fontSize: widget.size.width * 0.05), ), Padding( padding: const EdgeInsets.all(8), child: ElevatedButton( style: ElevatedButton.styleFrom( shape: const BeveledRectangleBorder()), onPressed: () async { _closedateTime = await showOmniDateTimePicker( context: context, initialDate: DateTime.now(), firstDate: DateTime(1600) .subtract(const Duration( days: 3652)), lastDate: DateTime.now().add( const Duration(days: 3652), ), is24HourMode: false, isShowSeconds: false, minutesInterval: 1, secondsInterval: 1, isForce2Digits: true, borderRadius: const BorderRadius.all( Radius.circular(16)), constraints: const BoxConstraints( maxWidth: 350, maxHeight: 650, ), transitionBuilder: (context, anim1, anim2, child) { return FadeTransition( opacity: anim1.drive( Tween( begin: 0, end: 1, ), ), child: child, ); }, transitionDuration: const Duration( milliseconds: 200), barrierDismissible: true, ); // print("dateTime: $_opendateTime"); }, child: const Text( "SET CLOSING TIME"), ), // Text( "Date: ${_opendateTime!.day}/${_opendateTime!.month} Time: ${_opendateTime!.hour}:${_opendateTime!.minute}")), ) ], )), SizedBox( height: widget.size.height * 0.02, ), const IsLiveCheckBox(), ], ), ), actions: [ ElevatedButton( onPressed: () { Navigator.of(context).pop(); }, style: ElevatedButton.styleFrom( backgroundColor: Colors.red), child: const Text( "Cancel", style: TextStyle(color: Colors.black), ), ), ElevatedButton( onPressed: () async { if (isLive == false) { ScaffoldMessenger.of(context) .showSnackBar(const SnackBar( content: Text("Please Check the Box"), backgroundColor: Colors.red, )); } else if (_opendateTime != null && _closedateTime != null && (_opendateTime ?.compareTo(DateTime.now()) == 0 || _opendateTime ?.compareTo(DateTime.now()) == 1) && _closedateTime ?.compareTo(DateTime.now()) == 1 && _closedateTime ?.compareTo(_opendateTime!) == 1) { String openTime = "Date: ${_opendateTime!.day}/${_opendateTime!.month} Time: ${_opendateTime!.hour}:${_opendateTime!.minute} "; String closeTime = "Date: ${_closedateTime!.day}/${_closedateTime!.month} Time: ${_closedateTime!.hour}:${_closedateTime!.minute} "; opendatetime = _opendateTime!; closedatetime = _closedateTime!; bool isActive = await Appointments(context) .goActive(_opendateTime!, _closedateTime!, userDetailsMap); if (isActive) { setState(() { open = openTime; close = closeTime; // print("line 364 runned step 1"); }); Navigator.of(context).pop(); } else { Navigator.of(context).pop(); } } else { ScaffoldMessenger.of(context) .showSnackBar(const SnackBar( content: Text( "Please Check Your Opening Time and Closing Time"), backgroundColor: Colors.red, )); } }, style: ElevatedButton.styleFrom( backgroundColor: maingreen), child: const Text( "Confirm", style: TextStyle(color: Colors.black), ), ), ], )); }, child: Card( color: Colors.orange, shape: const RoundedRectangleBorder(), child: SizedBox( height: widget.size.height * 0.05, width: double.infinity, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon(Icons.timelapse_sharp), Text( "Schedule Appointments", style: TextStyle(fontSize: widget.size.width * 0.05), ), ], ), ), ), ), ), SizedBox(height: widget.size.height * 0.01), const Text("Scheduled Appointments"), ScheduledAppointments( docUid: userDetailsMap['uid'], size: widget.size, ) ], ), ), )); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/doctor_pages/patient_profile.dart
import 'package:flutter/material.dart'; import 'package:swasthya_setu/doctor_pages/write_report.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/customtextfield.dart'; class PatientProfilePage extends StatefulWidget { final Size size; final String name; final String number; final String age; final String image; final String gender; final String mail; final String address; final Map<String, dynamic> patientMap; const PatientProfilePage({ Key? key, required this.size, required this.name, required this.number, required this.age, required this.image, required this.gender, required this.mail, required this.address, required this.patientMap, }) : super(key: key); @override State<PatientProfilePage> createState() => _SigninUserProfilePageState(); } class _SigninUserProfilePageState extends State<PatientProfilePage> { @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( backgroundColor: const Color.fromARGB(255, 199, 215, 180), body: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return Center( child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ SizedBox( height: constraints.maxHeight * 0.02, ), SizedBox( height: constraints.maxHeight * 0.02, ), CircleAvatar( backgroundImage: NetworkImage(widget.image), radius: constraints.maxHeight * 0.1, ), Expanded( child: ListView( children: [ SizedBox( height: constraints.maxHeight * 0.05, ), getReadTextField("Name", constraints.maxHeight * 0.05, widget.name), SizedBox( height: constraints.maxHeight * 0.05, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded( child: getReadTextField("Age", constraints.maxHeight * 0.05, widget.age), ), SizedBox( width: constraints.maxWidth * 0.09, ), Expanded( child: getReadTextField( "Gender", constraints.maxHeight * 0.05, widget.gender, ), ), ], ), SizedBox( height: constraints.maxHeight * 0.05, ), getReadTextField("Phone Number", constraints.maxHeight * 0.05, widget.number), SizedBox( height: constraints.maxHeight * 0.05, ), getReadTextField("Email Address", constraints.maxHeight * 0.05, widget.mail), SizedBox( height: constraints.maxHeight * 0.05, ), getReadTextField("Address", constraints.maxHeight * 0.07, widget.address), SizedBox( height: constraints.maxHeight * 0.015, ), Align( alignment: AlignmentDirectional.bottomCenter, child: ElevatedButton.icon( style: ElevatedButton.styleFrom( backgroundColor: maingreen, fixedSize: Size(double.infinity, widget.size.height * 0.07)), onPressed: () { Navigator.of(context).push( MaterialPageRoute( builder: (context) => WriteReportPage( patientMap: widget.patientMap))); }, icon: Icon( Icons.handshake, color: Colors.black, size: widget.size.height * 0.03, ), label: Text( "Attended", style: TextStyle( color: Colors.black, fontSize: widget.size.height * 0.02), ))) ], ), ), ], ), ), ); }, ), ), ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/doctor_pages/reports.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:swasthya_setu/backend/appointment.dart'; import 'package:swasthya_setu/providers/details.dart'; import 'package:swasthya_setu/widgets/attendedpatient_tile.dart'; class Reports extends StatelessWidget { final String userUid; const Reports({super.key, required this.userUid}); @override Widget build(BuildContext context) { Map<String, dynamic> userDetailsMap = Provider.of<DoctorDetailsProvider>(context, listen: true) .getDoctorDetailsMap; return SafeArea( child: Scaffold( appBar: AppBar( title: const Text( "Appointments", style: TextStyle(fontWeight: FontWeight.bold), ), ), body: StreamBuilder( stream: report(userDetailsMap['uid']), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot<Object?>> snapshot) { if (snapshot.hasError) { return const Center( child: Text("Some Error Occurred , Please try after some time")); } else if (snapshot.connectionState == ConnectionState.waiting) { return const Center( child: Text("Loading..."), ); }else{ return ListView.builder( itemCount: snapshot.data!.size, itemBuilder: (context, int index) { return snapshot.data!.docs .map((document) => patientTile(document,MediaQuery.of(context).size,)) .toList()[index]; }); } }, ), )); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/doctor_pages/doctor_profile_page.dart
import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:swasthya_setu/backend/authorization.dart'; import 'package:swasthya_setu/utils/customtextfield.dart'; class DoctorProfilePage extends StatefulWidget { final Size size; final String name; final String number; final String age; final String image; final String gender; final String mail; final String address; const DoctorProfilePage({ Key? key, required this.size, required this.name, required this.number, required this.age, required this.image, required this.gender, required this.mail, required this.address, }) : super(key: key); @override State<DoctorProfilePage> createState() => _SigninUserProfilePageState(); } class _SigninUserProfilePageState extends State<DoctorProfilePage> { @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( backgroundColor: const Color.fromARGB(255, 199, 215, 180), body: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return Center( child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ SizedBox( height: constraints.maxHeight * 0.02, ), SizedBox( height: constraints.maxHeight * 0.02, ), Stack( children: [ CircleAvatar( backgroundImage: NetworkImage(widget.image), radius: constraints.maxHeight * 0.1, ), Positioned( bottom: constraints.maxHeight * 0.01, right: constraints.maxWidth * 0.02, child: IconButton( icon: Icon( Icons.add_a_photo, size: constraints.maxHeight * 0.05, ), onPressed: () async { }, ), ), ], ), Expanded( child: ListView( children: [ SizedBox( height: constraints.maxHeight * 0.05, ), getReadTextField( "Name", constraints.maxHeight * 0.05, widget.name), SizedBox( height: constraints.maxHeight * 0.05, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded( child: getReadTextField( "Experience", constraints.maxHeight * 0.05, widget.age), ), SizedBox( width: constraints.maxWidth * 0.09, ), Expanded( child: getReadTextField( "Gender", constraints.maxHeight * 0.05, widget.gender, ), ), ], ), SizedBox( height: constraints.maxHeight * 0.05, ), getReadTextField( "Phone Number", constraints.maxHeight * 0.05, widget.number), SizedBox( height: constraints.maxHeight * 0.05, ), getReadTextField( "Email Address", constraints.maxHeight * 0.05, widget.mail), SizedBox( height: constraints.maxHeight * 0.05, ), getReadTextField( "Password", constraints.maxHeight * 0.05, "*****"), SizedBox( height: constraints.maxHeight * 0.05, ), getReadTextField( "Address", constraints.maxHeight * 0.07, widget.address), SizedBox( height: constraints.maxHeight * 0.05, ), CupertinoButton( onPressed: () async { await LoginMethod(context, FirebaseAuth.instance) .logout(); }, color: Colors.red, child: const Text("Sign Out"), ), ], ), ), ], ), ), ); }, ), ), ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/doctor_pages/write_report.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:swasthya_setu/backend/appointment.dart'; import 'package:swasthya_setu/providers/details.dart'; import 'package:swasthya_setu/utils/colours.dart'; class WriteReportPage extends StatelessWidget { final Map<String, dynamic> patientMap; const WriteReportPage({super.key, required this.patientMap}); @override Widget build(BuildContext context) { Map<String, dynamic> userDetailsMap = Provider.of<DoctorDetailsProvider>(context, listen: true) .getDoctorDetailsMap; TextEditingController _getReport = TextEditingController(); TextEditingController _getMedicine = TextEditingController(); TextEditingController _getTest = TextEditingController(); TextEditingController _getPrecaution = TextEditingController(); Size size = MediaQuery.of(context).size; return SafeArea( child: Scaffold( appBar: AppBar( actions: [ IconButton( icon: const Icon( Icons.done, color: Colors.white, weight: 4, size: 30, ), onPressed: () async { patientMap.addAll({ "report": _getReport.text, "medicine": _getMedicine.text, "test": _getTest.text, "precaution": _getPrecaution.text, "attentedAt": DateTime.now() }); userDetailsMap.addAll({ "report": _getReport.text, "medicine": _getMedicine.text, "test": _getTest.text, "precaution": _getPrecaution.text, "attentedAt": DateTime.now() }); // print(patientMap); // print("***********************************"); // print(userDetailsMap); await attended(patientMap, userDetailsMap, context, size); Navigator.of(context).pop(); Navigator.of(context).pop(); }, ), const SizedBox( width: 10, ) ], title: const Row( children: [ Icon( Icons.pending_actions, color: Colors.white, weight: 8, size: 40, ), SizedBox( width: 5, ), Text( "Report", style: TextStyle( color: Colors.white, fontWeight: FontWeight.w600, fontSize: 30, fontFamily: 'Dosis', ), ), ], ), centerTitle: true, backgroundColor: maingreen, ), body: Padding( padding: const EdgeInsets.all(8.0), child: ListView(children: [ const SizedBox( height: 10, ), Text( "Report/Comments", style: TextStyle( color: Colors.black, fontWeight: FontWeight.w600, fontSize: size.height * 0.035, fontFamily: 'Dosis', ), ), const SizedBox( height: 10, ), SizedBox( width: double.infinity, child: TextField( autofocus: true, controller: _getReport, maxLines: 8, keyboardType: TextInputType.multiline, // this is change textInputAction: TextInputAction.newline, // this is change decoration: const InputDecoration( focusedBorder: OutlineInputBorder(), enabledBorder: OutlineInputBorder(), hintStyle: TextStyle(fontSize: 14, color: Colors.black), ), ), ), const SizedBox( height: 10, ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ SizedBox( width: size.width * 0.45, child: Column( children: [ Text( "Medicine(s)", style: TextStyle( color: Colors.black, fontWeight: FontWeight.w600, fontSize: size.height * 0.035, fontFamily: 'Dosis', ), ), SizedBox( child: TextField( autofocus: true, controller: _getMedicine, maxLines: 8, keyboardType: TextInputType.multiline, // this is change textInputAction: TextInputAction.newline, // this is change decoration: const InputDecoration( focusedBorder: OutlineInputBorder(), enabledBorder: OutlineInputBorder(), hintStyle: TextStyle(fontSize: 14, color: Colors.black), ), ), ), ], ), ), SizedBox( width: size.width * 0.35, child: Column( children: [ Text( "Test(s)", style: TextStyle( color: Colors.black, fontWeight: FontWeight.w600, fontSize: size.height * 0.035, fontFamily: 'Dosis', ), ), SizedBox( child: TextField( autofocus: true, controller: _getTest, maxLines: 8, keyboardType: TextInputType.multiline, // this is change textInputAction: TextInputAction.newline, // this is change decoration: const InputDecoration( focusedBorder: OutlineInputBorder(), enabledBorder: OutlineInputBorder(), hintStyle: TextStyle(fontSize: 14, color: Colors.black), ), ), ), ], ), ), ], ), Text( "Precaution(s)", style: TextStyle( color: Colors.black, fontWeight: FontWeight.w600, fontSize: size.height * 0.035, fontFamily: 'Dosis', ), ), const SizedBox( height: 10, ), SizedBox( width: double.infinity, child: TextField( autofocus: true, controller: _getPrecaution, maxLines: 2, keyboardType: TextInputType.multiline, // this is change textInputAction: TextInputAction.newline, // this is change decoration: const InputDecoration( focusedBorder: OutlineInputBorder(), enabledBorder: OutlineInputBorder(), hintStyle: TextStyle(fontSize: 14, color: Colors.black), ), ), ), ]), ), )); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/doctor_pages/patientstile.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:swasthya_setu/doctor_pages/patient_profile.dart'; import 'package:swasthya_setu/utils/colours.dart'; import 'package:swasthya_setu/utils/gettime.dart'; Widget scheduledTile(DocumentSnapshot document, Size size) { Map<String, dynamic> doc = (document.data() as Map<String, dynamic>); return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) => Padding( padding: const EdgeInsets.all(8), child: Container( width: constraints.maxWidth, decoration: BoxDecoration( shape: BoxShape.rectangle, color: maingreen, borderRadius: BorderRadius.circular(5)), child: Padding( padding: const EdgeInsets.all(8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // SizedBox(height: constraints.maxHeight*0.02,), Text( doc['name'], style: TextStyle( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.045), ), //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Text( "Booking Status : 'Booked/Attended/Missed'", style: TextStyle( color: Colors.black45, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), ), //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Text( "Booked on : ${getDateTimeText((doc['booking time'] as Timestamp).toDate())}", style: TextStyle( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), ), RichText( text: TextSpan( text: "Address : ${doc['address']}", style: TextStyle( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), )), Row( children: [ Text( "Check Patient Details : ", style: TextStyle( fontWeight: FontWeight.w600, fontSize: constraints.maxWidth * 0.04), ), CupertinoButton( child: const Text("Click Here"), onPressed: () { Navigator.of(context).push(MaterialPageRoute( builder: (context) => PatientProfilePage( patientMap:doc, size: size, name: doc['name'], number: doc['number'], age: doc['age'], image: doc['photoURL'], gender: doc['gender'], mail: doc['email'], address: doc['address']))); }) ], ) ], ), ), ), ), ); }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/doctor_pages/scheduledappointments.dart
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:swasthya_setu/backend/appointment.dart'; import 'package:swasthya_setu/doctor_pages/patientstile.dart'; class ScheduledAppointments extends StatelessWidget { final String docUid; final Size size; const ScheduledAppointments( {super.key, required this.docUid, required this.size}); @override Widget build(BuildContext context) { return StreamBuilder( stream: scheduledAppointments(docUid), builder: (BuildContext context, AsyncSnapshot<QuerySnapshot<Object?>> snapshot) { if (snapshot.hasError) { return const Center( child: Text("Some Error Occurred , Please try after some time")); } else if (snapshot.connectionState == ConnectionState.waiting) { return const Center( child: Text("Loading..."), ); } else { return Expanded( child: ListView.builder( itemCount: snapshot.data!.size, itemBuilder: (context, int index) { return snapshot.data!.docs .map((document) => scheduledTile(document, size)) .toList()[index]; }), ); } }, ); } }
0
mirrored_repositories/SwasthyaSetu/lib
mirrored_repositories/SwasthyaSetu/lib/backend/authorization.dart
import 'dart:typed_data'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/cupertino.dart'; // import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:swasthya_setu/backend/cloudstorage.dart'; import 'package:swasthya_setu/backend/userdetails.dart'; import 'package:swasthya_setu/doctor_pages/doctor_home_page.dart'; import 'package:swasthya_setu/pages/signinoption_page.dart'; import 'package:swasthya_setu/providers/details.dart'; import 'package:swasthya_setu/user_pages/user_home_page.dart'; import 'package:swasthya_setu/utils/toast.dart'; class Authorization { final FirebaseAuth _auth; final String uid; final String age; final String address; final String email; final String photourl; final String name; final String gender; final String bio; final String qualification; final String password; final List specializations; final BuildContext context; final Size size; final String number; Authorization( this._auth, this.uid, this.age, this.address, this.email, this.photourl, this.name, this.gender, this.bio, this.qualification, this.password, this.specializations, this.context, this.size, this.number); Future<void> signUpWithEmail(Uint8List file) async { try { UserCredential cred = await _auth.createUserWithEmailAndPassword( email: email, password: password); StorageMethods _storage = StorageMethods(_auth); String photoURL = await _storage.uploadImage(file); DoctorDetails doctor = DoctorDetails( cred.user!.uid, age, address, email, photoURL, name, gender, bio, qualification, password, specializations, number, "Doctor"); await _storage.uploadDoctorData(doctor, cred); await cred.user?.updateDisplayName("Doctor"); await cred.user?.updatePhotoURL(photoURL); // ignore: use_build_context_synchronously getScaffold("Account Created Successfully", context, Colors.green); await DoctorDetailsProvider().getDoctordetails(); // ignore: use_build_context_synchronously Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute(builder: (context) => DoctorHomePage(size: size)),(Route<dynamic> route) => false); } catch (e) { // print(e); getScaffold(e.toString(), context, Colors.red); } } } class UserAuthorization { final FirebaseAuth _auth; final String uid; final String age; final String address; final String email; final String photourl; final String name; final String gender; final String password; final BuildContext context; final Size size; final String number; UserAuthorization( this._auth, this.uid, this.age, this.address, this.email, this.photourl, this.name, this.gender, this.password, this.context, this.size, this.number); Future<void> signUpWithEmail(Uint8List file) async { try { UserCredential cred = await _auth.createUserWithEmailAndPassword( email: email, password: password); StorageMethods _storage = StorageMethods(_auth); String photoURL = await _storage.uploadImage(file); UserDetails user = UserDetails(cred.user!.uid, age, address, email, photoURL, name, gender, password, "User", number); await _storage.uploadUserData(user, cred); await cred.user?.updateDisplayName("User"); await cred.user?.updatePhotoURL(photoURL); getScaffold("Account Created Successfully", context, Colors.green); Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute(builder: (context) => UserHomePage(size: size)),(Route<dynamic> route) => false); } catch (e) { print(e); getScaffold(e.toString(), context, Colors.red); } } } class LoginMethod { final BuildContext context; final FirebaseAuth _auth; LoginMethod(this.context, this._auth); Future<String?> loginUser(String mail, String pass) async { try { UserCredential cred = await _auth.signInWithEmailAndPassword(email: mail, password: pass); getScaffold("Logged In Successfully", context, Colors.green); String? displayName = cred.user!.displayName; displayName == "User" ? await UserDetailsProvider().getUserdetails() : await DoctorDetailsProvider().getDoctordetails(); return displayName; } catch (e) { getScaffold("Login Failed", context, Colors.red); return "false"; } } Future<void> logout() async { try { await _auth.signOut(); Navigator.of(context).pushAndRemoveUntil( CupertinoPageRoute(builder: (context) => const SignInOptionPage()),(Route<dynamic> route) => false); getScaffold("Logged Out", context, Colors.green); } catch (e) { getScaffold("Try After Some Time", context, Colors.red); } } }
0