diff --git a/android/app/build.gradle b/android/app/build.gradle index 67b9d8e..19cf245 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -41,6 +41,13 @@ android { main.java.srcDirs += 'src/main/kotlin' } + lintOptions { + disable 'InvalidPackage' + disable "Instantiatable" + checkReleaseBuilds false + abortOnError false + } + defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.movielab" @@ -65,4 +72,4 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +} \ No newline at end of file diff --git a/lib/pages/main/profile/profile.dart b/lib/pages/main/profile/profile.dart index 5f82136..5da02b5 100644 --- a/lib/pages/main/profile/profile.dart +++ b/lib/pages/main/profile/profile.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; +import 'package:get/get.dart'; +import 'package:movielab/pages/main/profile/profile_controller.dart'; +import 'package:movielab/pages/main/profile/sections/user_profile/edit_user_profile.dart'; import 'sections/lists.dart'; import 'sections/settings.dart'; @@ -11,30 +13,44 @@ class ProfilePage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - centerTitle: true, - automaticallyImplyLeading: false, - title: const Text("Profile", - style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold)), - ), - body: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: ListView( - physics: const BouncingScrollPhysics(), - children: const [ - SizedBox(height: 25), - ProfilePageUserProfile(), - SizedBox(height: 40), - ProfilePageLists(), - SizedBox(height: 40), - ProfilePageSettings(), - SizedBox(height: 40), - ProfilePageSocials(), - SizedBox(height: 40), - ], - ), - ), - ); + return GetBuilder(builder: (_) { + return AnimatedSwitcher( + duration: const Duration(milliseconds: 250), + child: _buildBody(_.name), + ); + }); + } +} + +_buildBody(final String name) { + switch (name) { + case "Your name": + return const ProfilePageEditUserProfile(); + default: + return Scaffold( + appBar: AppBar( + centerTitle: true, + automaticallyImplyLeading: false, + title: const Text("Profile", + style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold)), + ), + body: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: ListView( + physics: const BouncingScrollPhysics(), + children: const [ + SizedBox(height: 25), + ProfilePageUserProfile(), + SizedBox(height: 40), + ProfilePageLists(), + SizedBox(height: 40), + ProfilePageSettings(), + SizedBox(height: 40), + ProfilePageSocials(), + SizedBox(height: 40), + ], + ), + ), + ); } } diff --git a/lib/pages/main/profile/sections/user_profile/stats_box.dart b/lib/pages/main/profile/sections/user_profile/stats_box.dart index 9a8548c..9d27402 100644 --- a/lib/pages/main/profile/sections/user_profile/stats_box.dart +++ b/lib/pages/main/profile/sections/user_profile/stats_box.dart @@ -3,36 +3,41 @@ import 'package:flutter/material.dart'; Widget statsBox(BuildContext context, {required final String value, required final String text, + final double? width, final int sizeType = 1}) => - TextButton( - onPressed: () {}, - style: TextButton.styleFrom( - padding: EdgeInsets.zero, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + SizedBox( + width: width ?? MediaQuery.of(context).size.width * 0.25, + child: TextButton( + onPressed: () {}, + style: TextButton.styleFrom( + padding: EdgeInsets.zero, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), ), - ), - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - value, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: sizeType == 2 ? 18 : 24), - ), - const SizedBox(height: 2), - Text( - text, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white.withOpacity(0.75), - fontWeight: FontWeight.w600), - ), - ], + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + value, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: sizeType == 2 ? 18 : 24), + ), + const SizedBox(height: 2), + Text( + text, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white.withOpacity(0.75), + fontWeight: FontWeight.w600), + ), + ], + ), ), ), ); diff --git a/lib/pages/main/profile/sections/user_profile/user_profile.dart b/lib/pages/main/profile/sections/user_profile/user_profile.dart index 69c0949..07f7aaa 100644 --- a/lib/pages/main/profile/sections/user_profile/user_profile.dart +++ b/lib/pages/main/profile/sections/user_profile/user_profile.dart @@ -140,6 +140,7 @@ class ProfilePageUserProfile extends StatelessWidget { statsBox(context, value: _.sortedContentRatings?[0] ?? "Unknown", text: "Favorite\nContent-Rating", + width: MediaQuery.of(context).size.width * 0.325, sizeType: 2), ], ),