Created
December 16, 2023 15:08
-
-
Save sma/7d334d838ca68c67ab1ac7a97ec73c92 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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