Skip to content

Instantly share code, notes, and snippets.

@AliOsm
Created November 18, 2022 10:53
Show Gist options
  • Save AliOsm/8b924620444fe4da85753739221b9729 to your computer and use it in GitHub Desktop.
Save AliOsm/8b924620444fe4da85753739221b9729 to your computer and use it in GitHub Desktop.
Example Flutter screen
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'تطبيق فلاتر',
theme: ThemeData(
primarySwatch: Colors.blue,
),
builder: (context, child) {
return const Directionality(
textDirection: TextDirection.rtl,
child: MyHomePage(),
);
},
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
String hadithText =
'عَنْ أَمِيرِ الْمُؤْمِنِينَ أَبِي حَفْصٍ عُمَرَ بْنِ الْخَطَّابِ رَضِيَ اللهُ عَنْهُ قَالَ: سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ: " إنَّمَا الْأَعْمَالُ بِالنِّيَّاتِ، وَإِنَّمَا لِكُلِّ امْرِئٍ مَا نَوَى، فَمَنْ كَانَتْ هِجْرَتُهُ إلَى اللَّهِ وَرَسُولِهِ فَهِجْرَتُهُ إلَى اللَّهِ وَرَسُولِهِ، وَمَنْ كَانَتْ هِجْرَتُهُ لِدُنْيَا يُصِيبُهَا أَوْ امْرَأَةٍ يَنْكِحُهَا فَهِجْرَتُهُ إلَى مَا هَاجَرَ إلَيْهِ". رَوَاهُ إِمَامَا الْمُحَدِّثِينَ أَبُو عَبْدِ اللهِ مُحَمَّدُ بنُ إِسْمَاعِيل بن إِبْرَاهِيم بن الْمُغِيرَة بن بَرْدِزبَه الْبُخَارِيُّ الْجُعْفِيُّ [رقم:1]، وَأَبُو الْحُسَيْنِ مُسْلِمٌ بنُ الْحَجَّاج بن مُسْلِم الْقُشَيْرِيُّ النَّيْسَابُورِيُّ [رقم:1907] رَضِيَ اللهُ عَنْهُمَا فِي "صَحِيحَيْهِمَا" اللذَينِ هُمَا أَصَحُّ الْكُتُبِ الْمُصَنَّفَةِ.';
return Scaffold(
appBar: AppBar(
title: Text('الحديث الأول'),
),
body: Padding(
padding: EdgeInsets.all(16),
child: ListView(
children: [
Padding(
padding: EdgeInsets.only(bottom: 16),
child: Text(
'الحديث',
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.bold),
),
),
Padding(
padding: EdgeInsets.only(bottom: 16),
child: Text(
hadithText,
textAlign: TextAlign.justify,
style: TextStyle(fontSize: 24),
),
),
Padding(
padding: EdgeInsets.only(bottom: 16),
child: Text(
'شرح الحديث',
style: TextStyle(fontWeight: FontWeight.bold),
),
),
Padding(
padding: EdgeInsets.only(right: 16, bottom: 16),
child: Text(
hadithText,
textAlign: TextAlign.justify,
),
),
Row(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.only(left: 8),
child: ElevatedButton(
onPressed: () {},
child: Text('الحديث السابق'),
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.only(right: 8),
child: ElevatedButton(
onPressed: () {},
child: Text('الحديث التالي'),
),
),
),
],
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment