|
| 1 | +import 'package:flutter/material.dart'; |
| 2 | +import 'package:iconsax/iconsax.dart'; |
| 3 | +import 'package:text_to_image_gen/Pages/home_page.dart'; |
| 4 | +import 'package:text_to_image_gen/widgets/accents_color.dart'; |
| 5 | +import 'package:text_to_image_gen/widgets/theme_dialog.dart'; |
| 6 | +import 'package:url_launcher/url_launcher.dart'; |
| 7 | + |
| 8 | +class CustomDrawer extends StatelessWidget { |
| 9 | + const CustomDrawer({Key? key}) : super(key: key); |
| 10 | + |
| 11 | + @override |
| 12 | + Widget build(BuildContext context) { |
| 13 | + return Drawer( |
| 14 | + child: Container( |
| 15 | + child: Column( |
| 16 | + children: [ |
| 17 | + Container( |
| 18 | + child: DrawerHeader( |
| 19 | + child: Center( |
| 20 | + child: Image.asset('assets/images/Ai.png'), |
| 21 | + ), |
| 22 | + ), |
| 23 | + ), |
| 24 | + ListTile( |
| 25 | + leading: const Icon(Iconsax.home), |
| 26 | + title: Text( |
| 27 | + "Home", |
| 28 | + style: TextStyle( |
| 29 | + fontSize: 16, |
| 30 | + color: Theme.of(context).colorScheme.secondary, |
| 31 | + fontFamily: 'Nexa'), |
| 32 | + ), |
| 33 | + subtitle: Text( |
| 34 | + "Main page", |
| 35 | + style: TextStyle( |
| 36 | + color: Theme.of(context).colorScheme.secondary, |
| 37 | + fontWeight: FontWeight.bold, |
| 38 | + fontFamily: 'NexaLight', |
| 39 | + ), |
| 40 | + ), |
| 41 | + onTap: () { |
| 42 | + Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => const HomePage())); |
| 43 | + }, |
| 44 | + ), |
| 45 | + ListTile( |
| 46 | + leading: const Icon(Iconsax.layer), |
| 47 | + title: Text( |
| 48 | + "Appearance", |
| 49 | + style: TextStyle( |
| 50 | + fontSize: 16, |
| 51 | + color: Theme.of(context).colorScheme.secondary, |
| 52 | + fontFamily: 'Nexa'), |
| 53 | + ), |
| 54 | + subtitle: Text( |
| 55 | + "Select accent color", |
| 56 | + style: TextStyle( |
| 57 | + color: Theme.of(context).colorScheme.secondary, |
| 58 | + fontWeight: FontWeight.bold, |
| 59 | + fontFamily: 'NexaLight', |
| 60 | + ), |
| 61 | + ), |
| 62 | + onTap: () => showDialog( |
| 63 | + context: context, |
| 64 | + builder: (context) { |
| 65 | + return const AccentColors(); |
| 66 | + }), |
| 67 | + ), |
| 68 | + ListTile( |
| 69 | + leading: const Icon( |
| 70 | + Iconsax.brush, |
| 71 | + ), |
| 72 | + title: Text( |
| 73 | + 'Theme Mode', |
| 74 | + style: TextStyle( |
| 75 | + fontSize: 16, |
| 76 | + color: Theme.of(context).colorScheme.secondary, |
| 77 | + fontFamily: 'Nexa'), |
| 78 | + ), |
| 79 | + subtitle: Text( |
| 80 | + "Select theme mode", |
| 81 | + style: TextStyle( |
| 82 | + color: Theme.of(context).colorScheme.secondary, |
| 83 | + fontWeight: FontWeight.bold, |
| 84 | + fontFamily: 'NexaLight', |
| 85 | + ), |
| 86 | + ), |
| 87 | + onTap: () => showDialog( |
| 88 | + context: context, |
| 89 | + builder: (context) { |
| 90 | + return const ThemeModeDialog(); |
| 91 | + }), |
| 92 | + ), |
| 93 | + ListTile( |
| 94 | + leading: const Icon(Iconsax.hierarchy_2), |
| 95 | + title: Text( |
| 96 | + "Source code", |
| 97 | + style: TextStyle( |
| 98 | + fontSize: 16, |
| 99 | + color: Theme.of(context).colorScheme.secondary, |
| 100 | + fontFamily: 'Nexa'), |
| 101 | + ), |
| 102 | + subtitle: Text( |
| 103 | + "Github link", |
| 104 | + style: TextStyle( |
| 105 | + color: Theme.of(context).colorScheme.secondary, |
| 106 | + fontWeight: FontWeight.bold, |
| 107 | + fontFamily: 'NexaLight', |
| 108 | + ), |
| 109 | + ), |
| 110 | + onTap: () async { |
| 111 | + final Uri url = Uri.parse( |
| 112 | + 'https://github.com/VikramadityaDev/text_to_image_gen/'); |
| 113 | + if (!await launchUrl(url, |
| 114 | + mode: LaunchMode.externalApplication)) { |
| 115 | + throw Exception('Could not launch $url'); |
| 116 | + } |
| 117 | + }, |
| 118 | + ), |
| 119 | + ListTile( |
| 120 | + leading: const Icon(Iconsax.refresh_circle), |
| 121 | + title: Text( |
| 122 | + "Check for update", |
| 123 | + style: TextStyle( |
| 124 | + fontSize: 16, |
| 125 | + color: Theme.of(context).colorScheme.secondary, |
| 126 | + fontFamily: 'Nexa'), |
| 127 | + ), |
| 128 | + subtitle: Text( |
| 129 | + "Check releases", |
| 130 | + style: TextStyle( |
| 131 | + color: Theme.of(context).colorScheme.secondary, |
| 132 | + fontWeight: FontWeight.bold, |
| 133 | + fontFamily: 'NexaLight', |
| 134 | + ), |
| 135 | + ), |
| 136 | + onTap: () async { |
| 137 | + final Uri url = |
| 138 | + Uri.parse('https://github.com/VikramadityaDev/text_to_image_gen/releases/'); |
| 139 | + if (!await launchUrl(url, |
| 140 | + mode: LaunchMode.externalApplication)) { |
| 141 | + throw Exception('Could not launch $url'); |
| 142 | + } |
| 143 | + }, |
| 144 | + ), |
| 145 | + ListTile( |
| 146 | + leading: const Icon( |
| 147 | + Iconsax.sms_tracking, |
| 148 | + ), |
| 149 | + title: Text( |
| 150 | + "Join us on telegram", |
| 151 | + style: TextStyle( |
| 152 | + fontSize: 16, |
| 153 | + color: Theme.of(context).colorScheme.secondary, |
| 154 | + fontFamily: 'Nexa'), |
| 155 | + ), |
| 156 | + subtitle: Text( |
| 157 | + "For more new apps", |
| 158 | + style: TextStyle( |
| 159 | + color: Theme.of(context).colorScheme.secondary, |
| 160 | + fontWeight: FontWeight.bold, |
| 161 | + fontFamily: 'NexaLight', |
| 162 | + ), |
| 163 | + ), |
| 164 | + onTap: () async { |
| 165 | + final Uri url = |
| 166 | + Uri.parse('https://telegram.me/vikimediaofficial/'); |
| 167 | + if (!await launchUrl(url, |
| 168 | + mode: LaunchMode.externalApplication)) { |
| 169 | + throw Exception('Could not launch $url'); |
| 170 | + } |
| 171 | + }, |
| 172 | + ), |
| 173 | + ListTile( |
| 174 | + leading: const Icon( |
| 175 | + Iconsax.verify, |
| 176 | + ), |
| 177 | + title: Text( |
| 178 | + "</> & Crafted with 💛", |
| 179 | + style: TextStyle( |
| 180 | + fontSize: 16, |
| 181 | + color: Theme.of(context).colorScheme.secondary, |
| 182 | + fontFamily: 'Nexa'), |
| 183 | + ), |
| 184 | + subtitle: Text( |
| 185 | + "VikramadityaDev", |
| 186 | + style: TextStyle( |
| 187 | + color: Theme.of(context).colorScheme.secondary, |
| 188 | + fontWeight: FontWeight.bold, |
| 189 | + fontFamily: 'NexaLight', |
| 190 | + ), |
| 191 | + ), |
| 192 | + ), |
| 193 | + Expanded( |
| 194 | + child: Padding( |
| 195 | + padding: const EdgeInsets.all(10), |
| 196 | + child: Align( |
| 197 | + alignment: Alignment.bottomCenter, |
| 198 | + child: Text( |
| 199 | + 'v1.0.3', |
| 200 | + style: TextStyle( |
| 201 | + fontSize: 16, |
| 202 | + color: Theme.of(context).colorScheme.secondary, |
| 203 | + fontFamily: 'Nexa'), |
| 204 | + ), |
| 205 | + ), |
| 206 | + ), |
| 207 | + ), |
| 208 | + ], |
| 209 | + ), |
| 210 | + ), |
| 211 | + ); |
| 212 | + } |
| 213 | +} |
0 commit comments