hi im new in stackoverflow im wonder how could i build this whith flutter and thank alot :
Create a form allowing a user to Enter the Day of the month of his Date of Birth.
When clicking on the calculate button: We validate the form as follows: has. The day number must be between and 1 and 31. b. Month number: 1...12 vs. All fields are mandatory
After validation of the form, we will determine the astrological sign of the user and an image containing the determined sign will be displayed. Aries March 21 – April 19 Taurus April 20 – May 20 Gemini May 21 – June 21 Cancer June 22 – July 22 Leo July 23 – August 22 Virgo August 23 – September 22 Libra September 23 – October 23 Scorpio October 24 – November 22 Sagittarius November 23 – December 22 Capricorn December 23 – January 20 Aquarius January 21 – February 19 Pisces February 20 – March 20
Create a form allowing a user to Enter the Day of the month of his Date of Birth.
When clicking on the calculate button: We validate the form as follows: has. The day number must be between and 1 and 31. b. Month number: 1...12 vs. All fields are mandatory
After validation of the form, we will determine the astrological sign of the user and an image containing the determined sign will be displayed. Aries March 21 – April 19 Taurus April 20 – May 20 Gemini May 21 – June 21 Cancer June 22 – July 22 Leo July 23 – August 22 Virgo August 23 – September 22 Libra September 23 – October 23 Scorpio October 24 – November 22 Sagittarius November 23 – December 22 Capricorn December 23 – January 20 Aquarius January 21 – February 19 Pisces February 20 – March 20
CodePudding user response:
yes that's possible and pretty easy to do with Flutter.
CodePudding user response:
how ? i code it like this and im wonder
`import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final appTitle = 'Flutter Zodiac ';
return MaterialApp(
title: appTitle,
home: Scaffold(
appBar: AppBar(
title: Text(appTitle),
),
body: MyCustomForm(),
),
);
}
}
class MyCustomForm extends StatefulWidget {
@override
MyCustomFormState createState() {
return MyCustomFormState();
}
}
class MyCustomFormState extends State<MyCustomForm> {
final _formKey = GlobalKey<FormState>();
int jour = 0;
int mois = 0;
@override
Widget build(BuildContext context) {
return Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.date_range),
hintText: 'Day hint',
labelText: 'Day',
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Empty day";
}
if (int.parse(value) <= 0 || int.parse(value) > 31) {
return "Month >0 || Month<31";
}
return null;
},
onSaved: (newValue) {
jour = int.parse(newValue.toString());
},
),
TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.date_range),
hintText: 'Give Month',
labelText: 'Month',
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Empty input month";
}
if (int.parse(value) <= 0 || int.parse(value) > 12) {
return "Month >=1 | Month<=12";
}
return null;
},
onSaved: (newValue) {
mois = int.parse(newValue.toString());
},
),
new Container(
padding: const EdgeInsets.all(20.0),
child: new ElevatedButton(
child: const Text('Save'),
onPressed: () {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
switch(mois){
case 2:
}
}
},
)),
],
),
);
}
}`