// Some code
class Lesson04a extends StatefulWidget {
const Lesson04a({super.key});
@override
State<Lesson04a> createState() => _Lesson04aState();
}
class _Lesson04aState extends State<Lesson04a> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
colors: [Color(0xFF2567E8), Color(0xFF1CE6DA)],
),
),
child: Container(
height: double.infinity,
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 70),
padding: EdgeInsets.all(24),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_iconButton(),
SizedBox(height: 24),
_textSignUp(),
SizedBox(height: 12),
_login(),
SizedBox(height: 24),
_textFieldWidget('Full name'),
_textFieldWidget('Email'),
_textFieldWidget('Birth of date'),
_textFieldWidget('Phone number'),
SizedBox(height: 24),
_button(),
],
),
),
),
);
}
Widget _iconButton() {
return IconButton(onPressed: () {}, icon: Icon(Icons.arrow_back));
}
Widget _textSignUp() {
return Text(
'Sign up',
style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold),
);
}
Widget _login() {
return Row(
children: [
_name('Already have an account?'),
TextButton(
onPressed: () {},
child: Text(
'Login',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Color(0xFF4D81E7),
),
),
),
],
);
}
Widget _name(String title) {
return Text(
title,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Color(0xFF6C7278),
),
);
}
Widget _textFieldWidget(String title) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
title,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Color(0xFF6C7278),
),
),
SizedBox(height: 2),
TextField(
// obscureText: true,
// obscuringCharacter: '\$',
maxLines: 1,
maxLength: 5,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(
horizontal: 14,
vertical: 12.5,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: Color(0xFFEDF1F3)),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: Color(0xFF1D61E7)),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: Color(0xFFEDF1F3)),
),
suffixText: 'Hello',
hintText: 'ะะทัะฝ ะถะพะฝัะฝะดะพ 300 ัะธะผะฑะพะป',
helperText: 'Help',
//errorText: 'ะััะฝะดั ะพะฑััะทะฐัะตะปัะฝะพ ะถะฐะท',
labelText: 'Name',
prefixIcon: Icon(Icons.add),
// suffixIcon: IconButton(onPressed: (){}, icon: Icon(Icons.remove_red_eye_sharp))
),
),
SizedBox(height: 16),
],
);
}
Widget _button() {
return Center(
child: ElevatedButton(
onPressed: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('Hello'),
content: Container(
height: 200,
width: 400,
color: Colors.white,
),
actions: [TextButton(onPressed: () {}, child: Text('Ok'))],
);
},
);
},
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xFF1D61E7),
minimumSize: Size(295, 48),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: Text(
'Register',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
),
);
}
}
class Lesson04practise extends StatefulWidget {
const Lesson04practise({super.key});
@override
State<Lesson04practise> createState() => _Lesson04practiseState();
}
class _Lesson04practiseState extends State<Lesson04practise> {
// String selectedCountry = "๐ฐ๐ฌ";
//
// final Map<String, String> countryFlags = {
// "KG": "๐ฐ๐ฌ",
// "KZ": "๐ฐ๐ฟ",
// "RU": "๐ท๐บ",
// "US": "๐บ๐ธ",
// };
//
// final Map<String, String> dialCodes = {
// "KG": "+996",
// "KZ": "+7",
// "RU": "+7",
// "US": "+1",
// };
bool obscureText = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
child: TextField(
obscureText: obscureText,
decoration: InputDecoration(
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.eighteen_mp),
suffixIcon: IconButton(
onPressed: () {
setState(() {
obscureText = !obscureText;
});
},
icon: Icon(Icons.remove_red_eye_sharp),
),
),
),
),
);
}
}
class Lesson04b extends StatelessWidget {
const Lesson04b({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: _button(Icons.arrow_back),
title: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [Text('Header Label'), Text('Loremp text')],
),
centerTitle: true,
actions: [_button(Icons.more_vert)],
),
body: Column(
children: [
_containerWidget(Colors.orange),
_containerWidget(Colors.green),
_textWidget('Hello'),
_textWidget('Welcome'),
_textWidget('text'),
],
),
);
}
// Color, String, int -1,2 3 double - 1.0, 2.454645, IconData
Widget _textWidget(String text) {
return Text(
text,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
color: Colors.green,
),
);
}
Widget _containerWidget(Color color) {
return Container(height: 100, width: 100, color: color);
}
Widget _button(IconData icon) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: CircleAvatar(
child: IconButton(onPressed: () {}, icon: Icon(icon)),
),
);
}
}
class Lesson04c extends StatelessWidget {
const Lesson04c({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFFF5CB58),
appBar: AppBar(
backgroundColor: Color(0xFFF5CB58),
leading: IconButton(
onPressed: () {},
icon: Image.asset('assets/edit.png'),
),
title: Text('Filter'),
centerTitle: true,
actions: [
CircleAvatar(
backgroundColor: Colors.white,
child: IconButton(
onPressed: () {},
icon: Image.asset('assets/coke.png'),
),
),
SizedBox(width: 5),
CircleAvatar(
backgroundColor: Colors.white,
child: IconButton(
onPressed: () {},
icon: Image.asset('assets/coke.png'),
),
),
SizedBox(width: 25),
],
),
body: Container(
height: double.infinity,
width: double.infinity,
margin: EdgeInsets.only(top: 30),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
padding: EdgeInsets.only(top: 22, right: 33, left: 33),
child: Column(
children: [
_count(),
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
_containerWidget(Color(0xFFF5CB58), 'Snack', 'assets/coke.png'),
_containerWidget(Color(0xFFF3E9B5), 'Meal', 'assets/fork.png'),
Spacer()
],
),
],
),
),
);
}
Widget _count() {
return Row(
children: [
Text('\$50.0', style: TextStyle(fontSize: 25)),
Spacer(),
IconButton(
onPressed: () {},
icon: Icon(Icons.remove_circle, color: Color(0xFFFFDECF)),
),
Text('1', style: TextStyle(fontSize: 25)),
IconButton(
onPressed: () {},
icon: Icon(Icons.remove_circle, color: Color(0xFFE95322)),
),
],
);
}
// Color, String, int, double, IconData
// ==, !=, ??, ?, =, -=, +=,
Widget _containerWidget(Color color, String text, String image){
return Padding(
padding: const EdgeInsets.only(right: 15),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 62,
width: 49,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(30),
image: DecorationImage(image: AssetImage(image))
),
),
SizedBox(height: 7,),
Text(text,)
],
),
);
}
}