Skip to content

Instantly share code, notes, and snippets.

@anoochit

anoochit/main.dart

Created Jun 7, 2020
Embed
What would you like to do?
pawan locale
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:pawat/generated/l10n.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
localizationsDelegates: [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: S.delegate.supportedLocales,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
Widget _showMessage() {
return Text(S.of(context).textAppTitle);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Pawan")),
body: Container(child: _showMessage()),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment