|
1 | 1 | import 'dart:convert';
|
| 2 | +import 'dart:html' as html; |
2 | 3 | import 'package:flutter/material.dart';
|
3 | 4 | import 'package:flutter/cupertino.dart';
|
4 | 5 | import 'package:flutter_localization_generator/src/ui/views/raw_view.dart';
|
| 6 | +import 'package:flutter_localization_generator/src/utils/assets_const.dart'; |
5 | 7 | import 'package:flutter_localization_generator/src/utils/json_editor_utils.dart';
|
6 | 8 | import 'package:flutter_localization_generator/src/ui/views/form_data_view.dart';
|
7 | 9 | import 'package:flutter_localization_generator/src/services/firebase_service.dart';
|
8 | 10 | import 'package:flutter_localization_generator/src/ui/pages/downloading_page.dart';
|
| 11 | +import 'package:flutter_localization_generator/src/utils/arb_files_generator.dart'; |
9 | 12 | import 'package:flutter_localization_generator/src/ui/views/upload_file_view.dart';
|
10 | 13 | import 'package:flutter_localization_generator/src/ui/widget/custom_icon_button.dart';
|
11 | 14 |
|
@@ -34,108 +37,178 @@ class _MyHomePageState extends State<MyHomePage>
|
34 | 37 | centerTitle: true,
|
35 | 38 | elevation: 0,
|
36 | 39 | backgroundColor: defaultColorEditor,
|
| 40 | + actions: [ |
| 41 | + Padding( |
| 42 | + padding: const EdgeInsets.only(right: 30.0), |
| 43 | + child: SizedBox( |
| 44 | + child: InkWell( |
| 45 | + child: Image.asset(github), |
| 46 | + onTap: () { |
| 47 | + html.window.open('https://github.com/ZainUrRehmanKhan/Flutter-Localization-Generator', 'Flutter Localization Generator'); |
| 48 | + }, |
| 49 | + ), width: 30, height: 30, |
| 50 | + ), |
| 51 | + ) |
| 52 | + ], |
37 | 53 | ),
|
38 |
| - body: Column( |
39 |
| - crossAxisAlignment: CrossAxisAlignment.center, |
40 |
| - children: <Widget>[ |
41 |
| - Container( |
42 |
| - padding: EdgeInsets.symmetric(vertical: 15, horizontal: 30), |
43 |
| - child: Row( |
44 |
| - mainAxisAlignment: MainAxisAlignment.center, |
45 |
| - children: [ |
46 |
| - /// |
47 |
| - /// Email Text Field |
48 |
| - /// |
49 |
| - Container( |
50 |
| - width: 350, |
51 |
| - padding: EdgeInsets.symmetric(horizontal: 20), |
52 |
| - decoration: BoxDecoration( |
53 |
| - borderRadius: BorderRadius.all(Radius.circular(25)), |
54 |
| - border: Border.all(color: defaultColorEditor, width: 2), |
55 |
| - ), |
56 |
| - child: TextField( |
57 |
| - controller: emailEditingController, |
58 |
| - onChanged: (value) async { |
59 |
| - email = emailEditingController.text; |
60 |
| - }, |
61 |
| - cursorColor: defaultColorEditor, |
62 |
| - decoration: InputDecoration( |
63 |
| - border: InputBorder.none, |
64 |
| - hintText: 'youremail@email.com', |
65 |
| - hintStyle: TextStyle(color: Colors.grey[400])), |
66 |
| - ), |
67 |
| - ), |
| 54 | + body: SingleChildScrollView( |
| 55 | + physics: BouncingScrollPhysics(), |
| 56 | + child: SizedBox( |
| 57 | + height: 735, |
| 58 | + child: Column( |
| 59 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 60 | + children: <Widget>[ |
| 61 | + Container( |
| 62 | + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 30), |
| 63 | + child: Row( |
| 64 | + mainAxisAlignment: MainAxisAlignment.center, |
| 65 | + children: [ |
| 66 | + /// |
| 67 | + /// Email Text Field |
| 68 | + /// |
| 69 | + Container( |
| 70 | + width: 350, |
| 71 | + padding: EdgeInsets.symmetric(horizontal: 20), |
| 72 | + decoration: BoxDecoration( |
| 73 | + borderRadius: BorderRadius.all(Radius.circular(25)), |
| 74 | + border: Border.all(color: defaultColorEditor, width: 2), |
| 75 | + ), |
| 76 | + child: TextField( |
| 77 | + controller: emailEditingController, |
| 78 | + onChanged: (value) async { |
| 79 | + email = emailEditingController.text; |
| 80 | + }, |
| 81 | + cursorColor: defaultColorEditor, |
| 82 | + decoration: InputDecoration( |
| 83 | + border: InputBorder.none, |
| 84 | + hintText: 'youremail@email.com', |
| 85 | + hintStyle: TextStyle(color: Colors.grey[400])), |
| 86 | + ), |
| 87 | + ), |
68 | 88 |
|
69 |
| - /// |
70 |
| - /// Generate Button |
71 |
| - /// |
72 |
| - CustomIconButton( |
73 |
| - title: 'Generate', |
74 |
| - icon: CupertinoIcons.gear, |
75 |
| - onTap: () { |
76 |
| - if (emailEditingController.text != '' && |
77 |
| - RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") |
78 |
| - .hasMatch(emailEditingController.text)) { |
79 |
| - Map<String, dynamic> checkJson = jsonDecode(content); |
80 |
| - if (checkJson.length == 0) { |
81 |
| - ScaffoldMessenger.of(context).showSnackBar( |
82 |
| - SnackBar(content: Text('Not data found!'))); |
83 |
| - } else |
84 |
| - showDialog( |
85 |
| - context: context, |
86 |
| - builder: (context) { |
87 |
| - return localeDialog(); |
88 |
| - }, |
89 |
| - ); |
90 |
| - } else { |
91 |
| - ScaffoldMessenger.of(context).showSnackBar( |
92 |
| - SnackBar(content: Text('Invalid Email Address!'))); |
93 |
| - } |
94 |
| - }, |
95 |
| - ) |
96 |
| - ], |
97 |
| - ), |
98 |
| - ), |
99 |
| - Divider( |
100 |
| - height: 0.1, |
101 |
| - thickness: 0.1, |
102 |
| - color: defaultColorEditor, |
103 |
| - ), |
104 |
| - Container( |
105 |
| - color: defaultColorEditor, |
106 |
| - height: 60, |
107 |
| - width: double.infinity, |
108 |
| - child: TabBar( |
109 |
| - tabs: [ |
110 |
| - Text( |
111 |
| - 'Form Data', |
112 |
| - style: TextStyle(fontSize: 18, fontFamily: 'monospace'), |
| 89 | + /// |
| 90 | + /// Generate Button |
| 91 | + /// |
| 92 | + CustomIconButton( |
| 93 | + title: 'Generate', |
| 94 | + icon: CupertinoIcons.gear, |
| 95 | + onTap: () { |
| 96 | + if (emailEditingController.text != '' && |
| 97 | + RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") |
| 98 | + .hasMatch(emailEditingController.text)) { |
| 99 | + Map<String, dynamic> checkJson = jsonDecode(content); |
| 100 | + if (checkJson.length == 0) { |
| 101 | + ScaffoldMessenger.of(context).showSnackBar( |
| 102 | + SnackBar(content: Text('Not data found!'))); |
| 103 | + } else |
| 104 | + showDialog( |
| 105 | + context: context, |
| 106 | + builder: (context) { |
| 107 | + return localeDialog(); |
| 108 | + }, |
| 109 | + ); |
| 110 | + } else { |
| 111 | + ScaffoldMessenger.of(context).showSnackBar( |
| 112 | + SnackBar(content: Text('Invalid Email Address!'))); |
| 113 | + } |
| 114 | + }, |
| 115 | + ) |
| 116 | + ], |
113 | 117 | ),
|
114 |
| - Text( |
115 |
| - 'Raw', |
116 |
| - style: TextStyle(fontSize: 18, fontFamily: 'monospace'), |
| 118 | + ), |
| 119 | + Divider( |
| 120 | + height: 0.1, |
| 121 | + thickness: 0.1, |
| 122 | + color: defaultColorEditor, |
| 123 | + ), |
| 124 | + Container( |
| 125 | + color: defaultColorEditor, |
| 126 | + width: double.infinity, |
| 127 | + padding: EdgeInsets.symmetric(horizontal: 15), |
| 128 | + child: Row( |
| 129 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 130 | + children: [ |
| 131 | + Container( |
| 132 | + height: 60, |
| 133 | + child: TabBar( |
| 134 | + tabs: [ |
| 135 | + Text( |
| 136 | + 'Form Data', |
| 137 | + style: TextStyle(fontSize: 18, fontFamily: 'monospace'), |
| 138 | + ), |
| 139 | + Text( |
| 140 | + 'Raw', |
| 141 | + style: TextStyle(fontSize: 18, fontFamily: 'monospace'), |
| 142 | + ), |
| 143 | + Text( |
| 144 | + 'Upload File', |
| 145 | + style: TextStyle(fontSize: 18, fontFamily: 'monospace'), |
| 146 | + ), |
| 147 | + ], |
| 148 | + indicatorColor: Colors.white, |
| 149 | + isScrollable: true, |
| 150 | + controller: tabController, |
| 151 | + ), |
| 152 | + ), |
| 153 | + ElevatedButton.icon( |
| 154 | + onPressed: (){ |
| 155 | + exportJson(); |
| 156 | + }, |
| 157 | + icon: Icon(CupertinoIcons.arrow_down_doc, size: 15,), |
| 158 | + label: Text('Export', style: TextStyle(fontFamily: 'monospace'),), |
| 159 | + style: ButtonStyle( |
| 160 | + backgroundColor: MaterialStateColor.resolveWith((states) => Colors.white), |
| 161 | + foregroundColor: MaterialStateColor.resolveWith((states) => defaultColorEditor) |
| 162 | + ), |
| 163 | + ) |
| 164 | + ], |
117 | 165 | ),
|
118 |
| - Text( |
119 |
| - 'Upload File', |
120 |
| - style: TextStyle(fontSize: 18, fontFamily: 'monospace'), |
| 166 | + ), |
| 167 | + Expanded( |
| 168 | + child: TabBarView( |
| 169 | + children: [ |
| 170 | + FormDataInputView(), |
| 171 | + RawInputView(), |
| 172 | + UploadFileInputView(), |
| 173 | + ], |
| 174 | + controller: tabController, |
121 | 175 | ),
|
122 |
| - ], |
123 |
| - indicatorColor: Colors.white, |
124 |
| - isScrollable: true, |
125 |
| - controller: tabController, |
126 |
| - ), |
127 |
| - ), |
128 |
| - Expanded( |
129 |
| - child: TabBarView( |
130 |
| - children: [ |
131 |
| - FormDataInputView(), |
132 |
| - RawInputView(), |
133 |
| - UploadFileInputView(), |
134 |
| - ], |
135 |
| - controller: tabController, |
136 |
| - ), |
| 176 | + ), |
| 177 | + Container( |
| 178 | + width: double.infinity, |
| 179 | + color: Colors.grey[200], |
| 180 | + height: 80, |
| 181 | + padding: EdgeInsets.symmetric(vertical: 8.0), |
| 182 | + child: Column( |
| 183 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
| 184 | + children: [ |
| 185 | + Row( |
| 186 | + mainAxisAlignment: MainAxisAlignment.center, |
| 187 | + children: [ |
| 188 | + Text('Designed & Developed By ', style: TextStyle(color: Colors.grey[500], fontFamily: 'monospace'),), |
| 189 | + InkWell( |
| 190 | + child: Text('Zain Ur Rehman', style: TextStyle(color: defaultColorEditor, fontFamily: 'monospace'),), |
| 191 | + onTap: () => html.window.open('https://github.com/ZainUrRehmanKhan', 'Zain Ur Rehman'), |
| 192 | + ) |
| 193 | + ], |
| 194 | + ), |
| 195 | + Row( |
| 196 | + mainAxisAlignment: MainAxisAlignment.center, |
| 197 | + children: [ |
| 198 | + Icon(Icons.copyright_outlined, color: Colors.grey[500], size: 15,), |
| 199 | + Text(' 2021 copyright', style: TextStyle(color: Colors.grey[500], fontFamily: 'monospace'),), |
| 200 | + InkWell( |
| 201 | + child: Text(' SparkoSol, Pakistan', style: TextStyle(color: defaultColorEditor, fontFamily: 'monospace'),), |
| 202 | + onTap: () => html.window.open('https://github.com/SparcoT', 'SparkoSol, Pakistan'), |
| 203 | + ), |
| 204 | + ], |
| 205 | + ), |
| 206 | + ], |
| 207 | + ), |
| 208 | + ), |
| 209 | + ], |
137 | 210 | ),
|
138 |
| - ], |
| 211 | + ), |
139 | 212 | ),
|
140 | 213 | ),
|
141 | 214 | );
|
|
0 commit comments