improve: profile page

This commit is contained in:
Erfan Rahmati
2022-08-19 05:50:19 +04:30
parent 06eb526956
commit 0cef65f17d
4 changed files with 84 additions and 55 deletions

View File

@@ -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"
}
}

View File

@@ -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<ProfileController>(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),
],
),
),
);
}
}

View File

@@ -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: <Widget>[
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: <Widget>[
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),
),
],
),
),
),
);

View File

@@ -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),
],
),