ElevatedButton(
style: ElevatedButton.styleFrom(
padding: EdgeInsets.all(20),
shape:
RoundedRectangleBorder(
borderRadius:
BorderRadius
.circular(
30))),
child: Text('Login'),
onPressed: () {},
)
DateTime? pickedDate =
await showDatePicker(
context: context,
locale:
Locale('th', 'TH'),
initialDate: DateTime
.now(), //get today's date
firstDate: DateTime(
2000), //DateTime.now() - not to allow to choose before today.
lastDate:
DateTime(2101));
pubspec.yaml
flutter_localizations:
sdk: flutter
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
DefaultCupertinoLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
locale: Locale('en', 'US'),
supportedLocales: [
const Locale('en', 'US'), // English
const Locale('th', 'TH'), // Thai
],
theme: ThemeData(
primarySwatch: Colors.indigo,
fontFamily: "NotoSansThai",
textTheme: TextTheme(
bodyText1: TextStyle(fontSize: 16.0),
bodyText2: TextStyle(fontSize: 16.0),
button: TextStyle(fontSize: 16),
)),
initialRoute: '/',
routes: {
'/': (context) => const HomePage(),
AuthenCodePage.routeName: (context) => const AuthenCodePage(),
}
import 'package:flutter/material.dart';
class AuthenCodePage extends StatefulWidget {
static const routeName = '/authen';
const AuthenCodePage({Key? key}) : super(key: key);
@override
State<AuthenCodePage> createState() => _AuthenCodePageState();
}
class _AuthenCodePageState extends State<AuthenCodePage> {
@override
Widget build(BuildContext context) {
final args = ModalRoute.of(context)!.settings.arguments as ScreenArguments;
return Scaffold(
appBar: AppBar(
title: Text('Authen'),
),
body: Center(
child: Text(args.message),
),
);
}
}
class ScreenArguments {
final String title;
final String message;
ScreenArguments(this.title, this.message);
}