Skip to content

Commit

Permalink
Minor UI updates and alignment fix (#31)
Browse files Browse the repository at this point in the history
* chore: fix minor alignment bugs

* fix: minor ui and alignment updates in home and analytic screens

* fix: minor ui change
  • Loading branch information
ShivamBansal07 authored Dec 27, 2023
1 parent 10ded5f commit 4af7be2
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/screens/analytic_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AnalyticScreen extends StatelessWidget {
),
body: Padding(
padding: const EdgeInsets.all(20), // Add padding to the widget
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
Text(
'Analytics',
style: TextStyle(
Expand Down
69 changes: 51 additions & 18 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ class _HomeScreenState extends State<HomeScreen> {
),
searchBox(),
const SizedBox(
height: 30,
height: 20,
),
customsearchBox(),
const SizedBox(
height: 10,
),
buttons(),
const Spacer(
flex: 2,
Expand Down Expand Up @@ -69,11 +72,11 @@ class _HomeScreenState extends State<HomeScreen> {
height: 68,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), color: Colors.black),
child: const Column(
child: Column(
children: [
Padding(padding: EdgeInsets.only(top: 21)),
Text(
'Customise',
!isCustomise ? 'Customise' : 'Randomise',
style: TextStyle(
color: Colors.white,
fontSize: 20,
Expand All @@ -86,6 +89,30 @@ class _HomeScreenState extends State<HomeScreen> {
const Spacer(),
GestureDetector(
onTap: () async {
showDialog(
// Show a loading dialog
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return Dialog(
child: SizedBox(
height: 100,
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Row(
children: [
CircularProgressIndicator(),
SizedBox(width: 16),
Text("Creating short link..."),
],
),
),
),
),
);
},
);
// Call the makeApiRequest function when "SHRINK" button is tapped
try {
final linkId = linkIdController.text.trim();
Expand All @@ -100,6 +127,7 @@ class _HomeScreenState extends State<HomeScreen> {
}
final link = await KzApi.createShortLink(
linkId, isCustomise ? shortCode : null);
Navigator.of(context).pop(); // Close the loading dialog
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => ResultScreen(
Expand All @@ -110,6 +138,7 @@ class _HomeScreenState extends State<HomeScreen> {
),
);
} on DioException catch (e) {
Navigator.of(context).pop(); // Close the loading dialog
debugPrint("${e.response!.data}");
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
Expand All @@ -131,6 +160,7 @@ class _HomeScreenState extends State<HomeScreen> {
),
);
} on Exception catch (e) {
Navigator.of(context).pop(); // Close the loading dialog
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Expand Down Expand Up @@ -196,19 +226,21 @@ class _HomeScreenState extends State<HomeScreen> {
return Visibility(
visible: isCustomise,
child: Container(
height: 65,
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: const Color(0xffF5F5F5),
borderRadius: BorderRadius.circular(19)),
child: TextField(
controller: shortCodeController,
decoration: const InputDecoration(
contentPadding: EdgeInsets.only(top: 15),
border: InputBorder.none,
hintText: 'Enter custom code...',
hintStyle: TextStyle(color: Color(0xff7C7D7D), fontSize: 26)),
)),
height: 65,
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: const Color(0xffF5F5F5),
borderRadius: BorderRadius.circular(19)),
child: TextField(
style: const TextStyle(fontSize: 20),
controller: shortCodeController,
decoration: const InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 16),
border: InputBorder.none,
hintText: 'Enter custom code...',
hintStyle: TextStyle(color: Color(0xff7C7D7D), fontSize: 22)),
),
),
);
}

Expand All @@ -221,11 +253,12 @@ class _HomeScreenState extends State<HomeScreen> {
borderRadius: BorderRadius.circular(19)),
child: TextField(
controller: linkIdController,
style: const TextStyle(fontSize: 20),
decoration: const InputDecoration(
contentPadding: EdgeInsets.only(top: 15),
contentPadding: EdgeInsets.symmetric(vertical: 16),
border: InputBorder.none,
hintText: 'Enter your link here...',
hintStyle: TextStyle(color: Color(0xff7C7D7D), fontSize: 26),
hintStyle: TextStyle(color: Color(0xff7C7D7D), fontSize: 22),
),
),
);
Expand Down

0 comments on commit 4af7be2

Please sign in to comment.