3floder
Sat Jun 22 2024 12:30:00 GMT+0000 (Coordinated Universal Time)
Saved by @mehran
import 'package:first/Login/component/butten_next.dart'; import 'package:first/Login/component/phone_textfield.dart'; import 'package:first/Login/component/user_textfield.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class Login extends StatefulWidget { const Login({super.key}); @override State<Login> createState() => _LoginState(); } class _LoginState extends State<Login> { final _formKey = GlobalKey<FormState>(); void _submitForm() { if (_formKey.currentState!.validate()) { // Perform the login action print('Form is valid'); } } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: SingleChildScrollView( padding: const EdgeInsets.all(35.0), child: Form( key: _formKey, child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ const Text( 'لطفا جهت ورود به برنامه، شماره تلفن خود را وارد نمایید', textAlign: TextAlign.right, style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black87, ), ), const SizedBox(height: 20), const UserNameTextField(), const SizedBox(height: 20), const PhoneNumberTextField(), const SizedBox(height: 20), GradientButton( text: 'ادامه', onPressed: _submitForm, ), const SizedBox(height: 20), const Text( 'با ورود و استفاده از برنامه، شما با شرایط و قوانین موافقت مینمایید', textAlign: TextAlign.end, style: TextStyle( fontSize: 12, color: Color.fromARGB(255, 0, 0, 0)), ), ], ), ), ), ), ); } } btnclass import 'package:flutter/material.dart'; class GradientButton extends StatelessWidget { final String text; final VoidCallback onPressed; const GradientButton({ Key? key, required this.text, required this.onPressed, }) : super(key: key); @override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( gradient: const LinearGradient( colors: [ Color.fromARGB(255, 24, 40, 219), Color.fromARGB(255, 25, 235, 2) ], begin: Alignment.topLeft, end: Alignment.bottomRight, ), borderRadius: BorderRadius.circular(8.0), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.2), spreadRadius: 1, blurRadius: 8, offset: const Offset(0, 4), ), ], ), child: ElevatedButton( onPressed: onPressed, style: ElevatedButton.styleFrom( padding: const EdgeInsets.symmetric(vertical: 16.0), backgroundColor: Colors.transparent, shadowColor: Colors.transparent, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), ), textStyle: const TextStyle( fontSize: 18, color: Colors.white, ), ), child: Text(text), ), ); } }
Comments