Skip to content

Instantly share code, notes, and snippets.

@sma
Created December 16, 2023 15:08
Show Gist options
  • Save sma/7d334d838ca68c67ab1ac7a97ec73c92 to your computer and use it in GitHub Desktop.
Save sma/7d334d838ca68c67ab1ac7a97ec73c92 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(const App());
}
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
builder: (context, child) => Directionality(
textDirection: Localizations.localeOf(context).languageCode == 'ar' //
? TextDirection.rtl
: TextDirection.ltr,
child: child!,
),
home: const Page(),
locale: const Locale('ar'),
supportedLocales: const [
Locale('de'),
Locale('ar'),
],
);
}
}
class Page extends StatelessWidget {
const Page({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.forward),
Text('Hi there!'),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment