اذهب إلى المحتوى

مروان مروان4

الأعضاء
  • المساهمات

    20
  • تاريخ الانضمام

  • تاريخ آخر زيارة

آخر الزوار

لوحة آخر الزوار معطلة ولن تظهر للأعضاء

إنجازات مروان مروان4

عضو مساهم

عضو مساهم (2/3)

5

السمعة بالموقع

  1. هلا بك عزيزي اول شي يعطيك الف صحه وعافيه يا رب الكود شغال 100%100 ولكن استفسار الان لدي 3 ايقونات منبثقة اذا احتاج اعمل onPressed لكل ايقونة منبثقه كيف ممكن نعملها لني بحثت في الكود ولم اجد مكان لهن
  2. السلام عليكم ورحمة الله وبركاته تحيه طيبه للجميع ي اخوان انا قمت بتغير للغة التطبيق او قمت بتمكين المستخدم من اختيار للغة التطبيق التي يفضلها ومع اختيار اللغة العربية يتم تغير اتجاه محتويات الصفحة من اليسار الى اليمين والعكس صحيح ايضا المشكلة الان لما استخدم floatingActionButton العادي مع تغير اللغة يتغير موقع الايقونة يمين يسار يسار يمين ..الخ ولكن لما استخدم floatingActionButton : SpeedDial موقع الايقونة لا يتغير مع تغير اللغة كل محتويات الصفحة يتغير اتجاها ما عدا هذا الايقونة هل يوجد لدى احدكم حل ؟ صورة تبين استخدام floatingActionButton العادي الموقع صحيح فيها الان صورة تبين المشكلة كود الصفحة كامل: import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_speed_dial/flutter_speed_dial.dart'; void main() { runApp( EasyLocalization( saveLocale: true, supportedLocales: [ Locale('en', 'US'), Locale('ar', 'SA')], path: 'assets/translations', fallbackLocale: Locale('en', 'US'), child: SecondScreens(), ), ); } class SecondScreens extends StatefulWidget { @override mainStates createState() => new mainStates(); } class mainStates extends State<SecondScreens> { @override Widget build(BuildContext context) { { return MaterialApp( localizationsDelegates:EasyLocalization.of(context).delegates, supportedLocales: EasyLocalization.of(context).supportedLocales, locale: EasyLocalization.of(context).locale, home: Scaffold( floatingActionButton: SpeedDial( animatedIcon: AnimatedIcons.menu_close, shape: CircleBorder(), children: [ SpeedDialChild( child: Icon(Icons.edit), backgroundColor: const Color(0xFFf6c626), label: 'Edit', ), ], ), ), ); } } }
  3. ربي يعطيك الف عافيه اخوي ربي يعطيك الف عافيه اخوي اهلا بك نعم قمت باتباع الطريقة الاولى التي اشرتي لها وهيا الاسهل بنسبه لي والمتوافقة لدى الكود الذي استعمله ويمكن تطبيقها بشكل سريع بدون اي تعقيدات كل الشكر لك على جوابك
  4. السلام عليكم ورحمة الله وبركاته تحيه طيبه للجميع في تطبيقي استعمل الطريقة التالية لترجمة الكلمات وتمكين المستخدم من اختيار اللغة المفضلة لديه easy_localization: ^2.3.2 EasyLocalization( saveLocale: true, supportedLocales: [ Locale('en', 'US'), Locale('ar', 'SA') ], path: 'assets/translations', fallbackLocale: Locale('en', 'US'), child: LoginScreen(), ), مشكلتي الان بعد تغيير للغة التطبيق كيف ممكن اغير اتجاه المحتويات من اليسار الى اليمين بعد اختيار اللغة العربية؟ ياليت اذا احد لديه فكره يفيدنا بها
  5. السلام عليكم ورحمة الله وبركاته تحيه طيبه للجميع اقوم بادخال قيم في مربع النص وبعد الضغط على زر الانتقال ارغب بنقل هذا القيم الى الصفحة التالية واستقبالها في الصفحة التالية قمت بعدد من المحاولة ولكن الامر لم ينجح الان يتم نقل رقم الهاتف من خلال الكود التالي : await Navigator.pushNamed(context, '/otpScreen', arguments: '$_dialCode${_contactEditingController.text}'); ولكن كيف ممكن نرسل قيم TextEditingController ايضا مع الرقم هذا الصفحة الاولى التي ارغب بارسال القيم منها كامل import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:onefrist/testjust/screens/login_screen/widget/country_picker.dart'; import 'package:onefrist/testjust/screens/login_screen/widget/custom_button.dart'; import 'package:onefrist/testjust/screens/otp_screen/otp_screen.dart'; import '../../../LawsOfNewUser.dart'; import '../../../loginpage.dart'; class LoginScreen extends StatefulWidget { @override _LoginScreenState createState() => _LoginScreenState(); } class _LoginScreenState extends State<LoginScreen> { final _contactEditingController = TextEditingController(); final nameController = TextEditingController(); final passwordController = TextEditingController(); var _dialCode = ''; //Login click with contact number validation Future<void> clickOnLogin(BuildContext context) async { if (_contactEditingController.text.isEmpty) { showErrorDialog(context, 'Contact number can\'t be empty.'); } else { final responseMessage = await Navigator.pushNamed(context, '/otpScreen', arguments: '$_dialCode${_contactEditingController.text}'); if (responseMessage != null) { showErrorDialog(context, responseMessage as String); } } } //callback function of country picker void _callBackFunction(String name, String dialCode, String flag) { _dialCode = dialCode; } //Alert dialogue to show error and response void showErrorDialog(BuildContext context, String message) { // set up the AlertDialog final CupertinoAlertDialog alert = CupertinoAlertDialog( title: const Text('Error'), content: Text('\n$message'), actions: <Widget>[ CupertinoDialogAction( isDefaultAction: true, child: const Text('Yes'), onPressed: () { Navigator.of(context).pop(); }, ) ], ); // show the dialog showDialog( context: context, builder: (BuildContext context) { return alert; }, ); } //build method for UI Representation @override Widget build(BuildContext context) { final screenHeight = MediaQuery.of(context).size.height; final screenWidth = MediaQuery.of(context).size.width; return Scaffold( body: Center( child: SingleChildScrollView( child: Container( padding: const EdgeInsets.all(16.0), width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: screenHeight * 0.05, ), Image.asset( 'assets/images/registration.png', height: screenHeight * 0.3, fit: BoxFit.contain, ), SizedBox( height: screenHeight * 0.02, ), const Text( 'Login', style: TextStyle(fontSize: 28, color: Colors.black), ), SizedBox( height: screenHeight * 0.02, ), const Text( 'Enter your mobile number to receive a verification code', textAlign: TextAlign.center, style: TextStyle( fontSize: 18, color: Colors.black, ), ), SizedBox( height: screenHeight * 0.04, ), Container( margin: EdgeInsets.symmetric(horizontal: screenWidth > 600 ? screenWidth * 0.2 : 16), padding: const EdgeInsets.all(16.0), decoration: BoxDecoration( color: Colors.white, // ignore: prefer_const_literals_to_create_immutables boxShadow: [ const BoxShadow( color: Colors.grey, offset: Offset(0.0, 1.0), //(x,y) blurRadius: 6.0, ), ], borderRadius: BorderRadius.circular(16.0)), child: Column( children: [ Container( margin: const EdgeInsets.all(8), padding: const EdgeInsets.symmetric(horizontal: 8.0), height: 45, decoration: BoxDecoration( border: Border.all( color: const Color.fromARGB(255, 253, 188, 51), ), borderRadius: BorderRadius.circular(36), ), child: Row( // ignore: prefer_const_literals_to_create_immutables children: [ CountryPicker( callBackFunction: _callBackFunction, headerText: 'Select Country', headerBackgroundColor: Theme.of(context).primaryColor, headerTextColor: Colors.white, ), SizedBox( width: screenWidth * 0.01, ), Expanded( child: TextField( decoration: const InputDecoration( hintText: 'Contact Number', ), controller: _contactEditingController, keyboardType: TextInputType.number, inputFormatters: [LengthLimitingTextInputFormatter(10)], ), ), ], ), ), const SizedBox( height: 8, ), Container( // width: 280, padding: EdgeInsets.all(5.0), child: TextField( maxLength: 8, controller: nameController, autocorrect: true, decoration: InputDecoration( prefixIcon:Icon(Icons.account_circle), border: OutlineInputBorder(), labelText: 'Enter_Your_Name_Here', ), ) ), CustomButton(clickOnLogin), ], ), ) ], ), ), ), ), ); } } وهذا الصفحة التاليه التي ارغب باستقبال القيم فيها الان يتم استقبال فقط رقم الهاتف ولكني ارغب باستقبال بيانات TextEditingController المرسلة ايضا import 'dart:async'; import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:http/http.dart' as http; import 'package:firebase_auth/firebase_auth.dart'; import 'package:pin_entry_text_field/pin_entry_text_field.dart'; // ignore: must_be_immutable class OtpScreen extends StatefulWidget { bool _isInit = true; var _contact = ''; @override _OtpScreenState createState() => _OtpScreenState(); } class _OtpScreenState extends State<OtpScreen> { String phoneNo; String smsOTP; String verificationId; String errorMessage = ''; final FirebaseAuth _auth = FirebaseAuth.instance; Timer _timer; //this is method is used to initialize data @override void didChangeDependencies() { // print(nameController.text); super.didChangeDependencies(); // Load data only once after screen load if (widget._isInit) { widget._contact = '${ModalRoute.of(context).settings.arguments as String}'; generateOtp(widget._contact); widget._isInit = false; } } //dispose controllers @override void dispose() { super.dispose(); } //build method for UI @override Widget build(BuildContext context) { final screenHeight = MediaQuery.of(context).size.height; final screenWidth = MediaQuery.of(context).size.width; return Scaffold( body: Center( child: SingleChildScrollView( child: Container( padding: const EdgeInsets.all(16.0), width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: screenHeight * 0.05, ), Image.asset( 'assets/images/logo.png', width: screenWidth * 0.7, fit: BoxFit.contain, ), SizedBox( height: screenHeight * 0.05, ), SizedBox( height: screenHeight * 0.02, ), const Text( 'Verification', style: TextStyle(fontSize: 28, color: Colors.black), ), SizedBox( height: screenHeight * 0.02, ), Text( 'Enter A 6 digit number that was sent to ${widget._contact}', textAlign: TextAlign.center, style: const TextStyle( fontSize: 18, color: Colors.black, ), ), SizedBox( height: screenHeight * 0.04, ), Container( margin: EdgeInsets.symmetric(horizontal: screenWidth > 600 ? screenWidth * 0.2 : 16), padding: const EdgeInsets.all(16.0), decoration: BoxDecoration( color: Colors.white, // ignore: prefer_const_literals_to_create_immutables boxShadow: [ const BoxShadow( color: Colors.grey, offset: Offset(0.0, 1.0), //(x,y) blurRadius: 6.0, ), ], borderRadius: BorderRadius.circular(16.0)), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( margin: EdgeInsets.only(left: screenWidth * 0.025), child: PinEntryTextField( fields: 6, onSubmit: (text) { smsOTP = text as String; }, ), ), SizedBox( height: screenHeight * 0.04, ), GestureDetector( onTap: () { verifyOtp(); }, child: Container( margin: const EdgeInsets.all(8), height: 45, width: double.infinity, decoration: BoxDecoration( color: const Color.fromARGB(255, 253, 188, 51), borderRadius: BorderRadius.circular(36), ), alignment: Alignment.center, child: const Text( 'Verify', style: TextStyle(color: Colors.black, fontSize: 16.0), ), ), ), ], ), ) ], ), ), ), ), ); } //Method for generate otp from firebase Future<void> generateOtp(String contact) async { final PhoneCodeSent smsOTPSent = (String verId, [int forceCodeResend]) { verificationId = verId; }; try { await _auth.verifyPhoneNumber( phoneNumber: contact, codeAutoRetrievalTimeout: (String verId) { verificationId = verId; }, codeSent: smsOTPSent, timeout: const Duration(seconds: 60), verificationCompleted: (AuthCredential phoneAuthCredential) {}, verificationFailed: (AuthException exception) { // Navigator.pop(context, exception.message); }); } catch (e) { handleError(e as PlatformException); // Navigator.pop(context, (e as PlatformException).message); } } //Method for verify otp entered by user Future<void> verifyOtp() async { if (smsOTP == null || smsOTP == '') { showAlertDialog(context, 'please enter 6 digit otp'); return; } try { final AuthCredential credential = PhoneAuthProvider.getCredential( verificationId: verificationId, smsCode: smsOTP, ); final AuthResult user = await _auth.signInWithCredential(credential); final FirebaseUser currentUser = await _auth.currentUser(); assert(user.user.uid == currentUser.uid); Navigator.pushReplacementNamed(context, '/homeScreen'); } catch (e) { handleError(e as PlatformException); } } //Method for handle the errors void handleError(PlatformException error) { switch (error.code) { case 'ERROR_INVALID_VERIFICATION_CODE': FocusScope.of(context).requestFocus(FocusNode()); setState(() { errorMessage = 'Invalid Code'; }); showAlertDialog(context, 'Invalid Code'); break; default: showAlertDialog(context, error.message); break; } } //Basic alert dialogue for alert errors and confirmations void showAlertDialog(BuildContext context, String message) { // set up the AlertDialog final CupertinoAlertDialog alert = CupertinoAlertDialog( title: const Text('Error'), content: Text('\n$message'), actions: <Widget>[ CupertinoDialogAction( isDefaultAction: true, child: const Text('Ok'), onPressed: () { Navigator.of(context).pop(); }, ) ], ); // show the dialog showDialog( context: context, builder: (BuildContext context) { return alert; }, ); } } ياليت اذا احد يعرف الطريقة يساعدنا
  6. اهلا اخي قمت باضافة السطر البرمجي الذي اشرت اليه انت فوق السطر الذي قمت بنشره انا في المشاركة السابقه انا استعمل الامر بعد تغير اللغة اعود الى الصفحة الاساسية ف تصبح الللغة المختارة قد تغيرت ولكن لو كملت العمل على التطبيق ودخلت الى موضوع ثم الى صفحة التعليات مثلا من الموضوع بعد الضغط على زر الرجوع في الاسفل يعود بي التطبيق الى الصفحة الاساسية وليس الى الصفحة التي قد وصلت بها الى التعليقات وكانه يتجاوز صفحة ثم تعود الصفحة الاساسية الى اللغة التي كانت عليه قبل تغير اللغة هذا المشكلة لذلك ارغب بتدمير الصفحات بعد الانتقال منها
  7. السلام عليكم ورحمة الله وبركاته تحيه طيبه للجميع اعمل على زر الانتقال وهو يعمل بدون مشاكل ولكن توجد مشكله في حالة دخولي الى اكتفتي 2 من اكتفتي 1 على سبيل المثال يبقى اكتفتي 1 شغال وفي حالته القديمة لو قمت برجوع له من ازار السامسونج الاساسيه رح يعود الاكتفتي السابق قبل عمل اي تغير فيه كيف ممكن تدمير الاكتفتي بعد الانتقال منه بحيث لا يعود لو قمت بضغط على زر الرجوع الخاصة بسامسونج السفليه احتاج الى تدمير الاكتفتي بعد الانتقال من خلال الكود التالي في الجافا كنا نستعمل finish () Navigator.push(context, MaterialPageRoute(builder: (context) => MainBasic()),); ياليت اذا احد معه فكره يفيدنا بها
  8. ربي يعطيك الف عافيه ي غالي الامر ناجح ميه ميه شكرا لك
  9. السلام عليكم ورحمة الله وبركاته تحيه طيبه للجميع انا واضع كود لتغير للغة التطبيق عربي - انجلش - ولكن اللغة لدي لا تتغير الا في حالة اعادة تشغيل التطبيق الان ابحث عن طريقة تمكني من اعادة تشغيل التطبيق بعد اختيار المستخدم للغة التي يريدها كيف يمكنني كتابة كود اعادة تشغيل التطبيق؟ ياليت من لديه فكرة يشاركنا بها
  10. السلام عليكم ورحمة الله وبركاته تحيه طيبه للجميع لدي استفسار لو تكرمتو محتاج الى مثال على الانتقال الى صفحة جديد في حالة وضع صح في مربع checkbox في لفلاتر حقيقي انني قمت بالبحث طويل عن مثال يشرح هذا العمل ولكن لم اجد انا محتاج اعمل checkbox وعند الضغط عليه من قبل المستخدم ينتقل الى صفحة مختلفة ياليت الي معه كود مثال على هذا العمل يشاركه معنا كل الشكر لكم
  11. اهلا بك عزيزي نعم كانت تنقصني بعض الملفات في مشروع ال ios قمت باضافتها وقد عمل بشكل ممتاز كل الشكر لك ي غالي اهلا بك اخوي لا ليس محظورة لني استخدمها على اندرويد بشكل ممتاز ولكن المشكله كانت انه تنقصني بعض الملفات في مشروع ios قمت باضافتها وتم حل المشكله كل الشكر لك اخوي
  12. السلام عليكم ورحمة الله وبركاته تحيه طيبه للجميع لدي استفسار لو تكرمتو .. انا اعمل على مشروع flutter قمت باضافة firebase authentication للاندوريد لتحقق من رقم المستخدم .. ولكن بعد نقل المشروع الى نظام mac وعمل تشغيل له من خلال اندرويد ستوديو في الماك يحصل انهيار او كراش ل التطبيق مع ظهور الخطاء التالي: حسب ما فهمت ان الخطاء بسبب firebase authentication الذي اضفته للاندرويد سابقا في الويندوز ولكني لم اجد حل لها ياليت اذا كان احد صادف هذا المشكله من قبل فيدنا بالحل الذي اتبعه لتجاوزها
×
×
  • أضف...