1
0
mirror of https://github.com/nisrulz/flutter-examples.git synced 2026-08-24 16:50:47 +00:00

refactor: standardize Dart and Android config across all 54 apps

- Bump all apps to sdk >=3.0.0 <4.0.0 and add flutter_lints + a shared
  analysis_options.yaml to every app (flutter analyze is now green repo-wide)
- Fix real compile errors in firebase_google_authentication and image_editor,
  plus deprecated APIs (Matrix4, SvgPicture.color, textScaleFactor),
  missing async 'mounted' guards, and misc lints via dart fix + manual fixes
- Align pubspec 'name' with each folder and Android namespace/applicationId
  with the documented github.nisrulz.* convention
- Convert bmi_calculator from a legacy Flutter module to a standard app
  with a proper android/ scaffold; fix missing android:exported in launcher
  manifests across 22 apps so all Android builds pass
- Untrack generated build files (GeneratedPluginRegistrant,
  .flutter-plugins-dependencies) and ignore them
This commit is contained in:
Nishant Srivastava
2026-08-17 17:26:39 +02:00
parent c8d2d4fffc
commit 5c53498119
297 changed files with 2037 additions and 930 deletions

5
.gitignore vendored
View File

@@ -351,6 +351,11 @@ build/
**/flutter_export_environment.sh
**/.dart_tool
**/.flutter-plugins-dependencies
**/GeneratedPluginRegistrant.java
**/GeneratedPluginRegistrant.h
**/GeneratedPluginRegistrant.m
**/GeneratedPluginRegistrant.swift
.pr-description-*/
.trash/

View File

@@ -0,0 +1,23 @@
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
linter:
rules:
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -10,6 +10,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View File

@@ -21,6 +21,8 @@ class FlutterAnalyticsApp extends StatelessWidget {
static FirebaseAnalyticsObserver observer =
FirebaseAnalyticsObserver(analytics: analytics);
const FlutterAnalyticsApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
@@ -48,7 +50,7 @@ class FlutterAnalyticsHome extends StatefulWidget {
final FirebaseAnalytics analytics;
final FirebaseAnalyticsObserver observer;
FlutterAnalyticsHome({
const FlutterAnalyticsHome({
super.key,
required this.title,
required this.analytics,

View File

@@ -7,7 +7,7 @@ class SingleItemTile extends StatefulWidget {
final double quantity;
final FirebaseAnalytics analytics;
SingleItemTile({
const SingleItemTile({super.key,
required this.itemName,
required this.price,
required this.quantity,
@@ -76,7 +76,7 @@ class _SingleItemTileState extends State<SingleItemTile> {
),
),
Text(
widget.quantity.toString() + ' kg',
'${widget.quantity} kg',
style: TextStyle(
color: Colors.grey,
fontSize: 12,

View File

@@ -20,6 +20,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
flutter:

View File

@@ -1,12 +1,7 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
@@ -16,23 +11,13 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -6,7 +6,7 @@ plugins {
}
android {
namespace = "com.example.penassignment"
namespace = "github.nisrulz.animation_example"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
@@ -16,7 +16,7 @@ android {
}
defaultConfig {
applicationId = "com.example.penassignment"
applicationId = "github.nisrulz.animation_example"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode

View File

@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.penassignment">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

View File

@@ -5,6 +5,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View File

@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.penassignment">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

View File

@@ -1,7 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
_HomePageState createState() => _HomePageState();
}
@@ -42,7 +43,7 @@ class _HomePageState extends State<HomePage>
return Scaffold(
backgroundColor: Colors.white,
body: Container(
body: SizedBox(
width: double.infinity,
height: size.height,
child: Stack(
@@ -52,16 +53,16 @@ class _HomePageState extends State<HomePage>
top: 80,
child: TextButton(
onPressed: () {},
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.all(Colors.green)),
child: const Text(
"North",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.white),
),
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Colors.green)))),
))),
Positioned(
top: size.height * 0.48,
left: -15,
@@ -69,16 +70,16 @@ class _HomePageState extends State<HomePage>
angle: 190.1,
child: TextButton(
onPressed: () {},
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.all(Colors.green)),
child: const Text(
"East",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.white),
),
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Colors.green))),
)),
)),
Positioned(
top: size.height * 0.48,
@@ -87,31 +88,31 @@ class _HomePageState extends State<HomePage>
angle: -190.1,
child: TextButton(
onPressed: () {},
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.all(Colors.green)),
child: const Text(
"West",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.white),
),
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Colors.green))),
)),
)),
Positioned(
bottom: 80,
child: TextButton(
onPressed: () {},
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.all(Colors.green)),
child: const Text(
"North",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.white),
),
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Colors.green)))),
))),
AnimatedBuilder(
animation: controller,
child: Container(

View File

@@ -7,7 +7,7 @@ void main() {
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});
// This widget is the root of your application.
@override

View File

@@ -1,4 +1,4 @@
name: penassignment
name: animation_example
description: A new Flutter project.
# The following line prevents the package from being accidentally published to

View File

@@ -1,12 +1,7 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
@@ -16,23 +11,13 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -6,7 +6,7 @@ plugins {
}
android {
namespace = "studio.sdev.biometrics"
namespace = "github.nisrulz.biometrics"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
@@ -16,7 +16,7 @@ android {
}
defaultConfig {
applicationId = "studio.sdev.biometrics"
applicationId = "github.nisrulz.biometrics"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode

View File

@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="studio.sdev.biometrics">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

View File

@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="studio.sdev.biometrics">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

View File

@@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
void main() => runApp(Biometrics());
class Biometrics extends StatelessWidget {
const Biometrics({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
@@ -17,6 +19,8 @@ class Biometrics extends StatelessWidget {
}
class Home extends StatefulWidget {
const Home({super.key});
@override
State<Home> createState() => _HomeState();
}
@@ -72,6 +76,7 @@ class _HomeState extends State<Home> {
});
} catch (e) {
// ---- Verification Failed
if (!context.mounted) return;
showDialog(
context: context,
builder: (c) => AlertDialog(

View File

@@ -4,7 +4,27 @@
# This file should be version controlled and should not be manually edited.
version:
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
channel: stable
revision: "4cf24164269a5ebf0c16a028a00727d0e77bbb05"
channel: "stable"
project_type: module
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 4cf24164269a5ebf0c16a028a00727d0e77bbb05
base_revision: 4cf24164269a5ebf0c16a028a00727d0e77bbb05
- platform: android
create_revision: 4cf24164269a5ebf0c16a028a00727d0e77bbb05
base_revision: 4cf24164269a5ebf0c16a028a00727d0e77bbb05
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

View File

@@ -1,3 +1,7 @@
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- build/**
@@ -7,7 +11,13 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
linter:
rules:
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

14
bmi_calculator/android/.gitignore vendored Normal file
View File

@@ -0,0 +1,14 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
.cxx/
# Remember to never publicly share your keystore.
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks

View File

@@ -0,0 +1,49 @@
plugins {
id("com.android.application")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "github.nisrulz.bmi_calculator"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "github.nisrulz.bmi_calculator"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
// Uses the version code from pubspec.yaml. When using split APKs, 1000 * ABI_VERSION
// is added automatically by Flutter. (https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions)
// You can force using the value of versionCode by specifying the `-P force-version-code-ignoring-abi=true`
// flag during build.
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
flutter {
source = "../.."
}

View File

@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@@ -0,0 +1,45 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="bmi_calculator"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>

View File

@@ -0,0 +1,5 @@
package github.nisrulz.bmi_calculator
import io.flutter.embedding.android.FlutterActivity
class MainActivity : FlutterActivity()

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@@ -0,0 +1,24 @@
allprojects {
repositories {
google()
mavenCentral()
}
}
val newBuildDir: Directory =
rootProject.layout.buildDirectory
.dir("../../build")
.get()
rootProject.layout.buildDirectory.value(newBuildDir)
subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}

View File

@@ -0,0 +1,6 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
# This newDsl flag was added by the Flutter template
android.newDsl=false
# This builtInKotlin flag was added by the Flutter template
android.builtInKotlin=false

View File

@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip

View File

@@ -0,0 +1,26 @@
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "9.1.0" apply false
id("org.jetbrains.kotlin.android") version "2.4.0" apply false
}
include(":app")

View File

@@ -22,7 +22,7 @@ class CalculateButton extends StatelessWidget {
child: TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all(Colors.white.withOpacity(0.10)),
WidgetStateProperty.all(Colors.white.withValues(alpha: 0.10)),
),
onPressed: onTap,
child: const Text(

View File

@@ -5,9 +5,9 @@ import 'package:bmi_calculator/palette.dart';
class CalculatorPage extends StatelessWidget {
CalculatorPage({
Key? key,
super.key,
required this.title,
}) : super(key: key);
});
final String title;

View File

@@ -13,7 +13,7 @@ void main() {
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});
// This widget is the root of your application.
@override

View File

@@ -1,5 +1,5 @@
name: bmi_calculator
description: A new Flutter module project.
description: A new Flutter project.
version: 1.0.0+1
@@ -19,8 +19,3 @@ dev_dependencies:
flutter:
uses-material-design: true
module:
androidX: true
androidPackage: github.nisrulz.bmi_calculator
iosBundleIdentifier: github.nisrulz.bmiCalculator

View File

@@ -0,0 +1,23 @@
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
linter:
rules:
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -11,6 +11,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View File

@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:project/models/ListTileModel.dart';
import 'package:bottom_sheet/models/ListTileModel.dart';
class MyHomePage extends StatefulWidget {
MyHomePage({super.key, required this.title});
const MyHomePage({super.key, required this.title});
final String title;
@@ -22,7 +22,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new ElevatedButton(
ElevatedButton(
child: Text(
"Bottom Sheet",
style: TextStyle(fontSize: 20),
@@ -42,14 +42,14 @@ void _openBottomSheet(context) {
showModalBottomSheet(
context: context,
builder: (builder) {
return new Container(
return Container(
padding: EdgeInsets.all(5.0),
child: new Wrap(
child: Wrap(
children: <Widget>[
getListTile(Icons.more, Colors.black45, "More", context),
getListTile(Icons.favorite, Colors.pink, "Favourites", context),
getListTile(Icons.account_box, Colors.blue, "Profile", context),
new Divider(
Divider(
thickness: 2.0,
height: 10.0,
),

View File

@@ -1,11 +1,13 @@
import 'package:flutter/material.dart';
import 'package:project/home.dart';
import 'package:bottom_sheet/home.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {

View File

@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
ListTile getListTile(icon, iconColor, titleText, context) {
return new ListTile(
leading: new Container(
return ListTile(
leading: SizedBox(
width: 4.0,
child: Icon(
icon,
@@ -10,7 +10,7 @@ ListTile getListTile(icon, iconColor, titleText, context) {
size: 24.0,
),
),
title: new Text(
title: Text(
titleText,
style: TextStyle(
fontSize: 14.0,

View File

@@ -1,4 +1,4 @@
name: project
name: bottom_sheet
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
@@ -32,6 +32,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

View File

@@ -0,0 +1,23 @@
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
linter:
rules:
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -11,6 +11,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View File

@@ -4,6 +4,8 @@ import 'screens/home.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(

View File

@@ -8,6 +8,8 @@ import 'dart:convert';
import 'package:folding_cell/folding_cell.dart';
class CountryList extends StatelessWidget {
const CountryList({super.key});
@override
Widget build(BuildContext context) {
List<dynamic> results = [];
@@ -31,25 +33,27 @@ class CountryList extends StatelessWidget {
body: FutureBuilder(
future: getAllCountriesData(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting)
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: CircularProgressIndicator(),
);
if (snapshot.hasError)
}
if (snapshot.hasError) {
return Center(
child: Text("Error! please check you wifi connection"),
);
}
results = jsonDecode(snapshot.data);
return ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: results.length,
itemBuilder: (context, index) {
var _foldingCellKey = GlobalKey<SimpleFoldingCellState>();
var foldingCellKey = GlobalKey<SimpleFoldingCellState>();
return Container(
color: Color(0xFF2e282a),
alignment: Alignment.topCenter,
child: SimpleFoldingCell.create(
key: _foldingCellKey,
key: foldingCellKey,
frontWidget: Builder(
builder: (BuildContext context) {
return GestureDetector(

View File

@@ -9,6 +9,8 @@ import 'package:flutter/material.dart';
class Home extends StatelessWidget {
final refreshKey = GlobalKey<RefreshIndicatorState>();
Home({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -28,8 +30,9 @@ class Home extends StatelessWidget {
future: getAllData(),
builder: (context, snapshot) {
// Display CircularProgressIndicator if data isn't fetched yet
if (snapshot.connectionState == ConnectionState.waiting)
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: CircularProgressIndicator());
}
// If in case an error occurs
if (snapshot.hasError) {
return Container(

View File

@@ -46,12 +46,12 @@ class CountrySearchDelegate extends SearchDelegate {
physics: BouncingScrollPhysics(),
itemCount: suggestionsList.length,
itemBuilder: (context, index) {
var _foldingCellKey = GlobalKey<SimpleFoldingCellState>();
var foldingCellKey = GlobalKey<SimpleFoldingCellState>();
return Container(
color: Color(0xFF2e282a),
alignment: Alignment.topCenter,
child: SimpleFoldingCell.create(
key: _foldingCellKey,
key: foldingCellKey,
frontWidget: Builder(
builder: (BuildContext context) {
return GestureDetector(
@@ -122,12 +122,12 @@ class CountrySearchDelegate extends SearchDelegate {
physics: BouncingScrollPhysics(),
itemCount: suggestionsList.length,
itemBuilder: (context, index) {
var _foldingCellKey = GlobalKey<SimpleFoldingCellState>();
var foldingCellKey = GlobalKey<SimpleFoldingCellState>();
return Container(
color: Color(0xFF2e282a),
alignment: Alignment.topCenter,
child: SimpleFoldingCell.create(
key: _foldingCellKey,
key: foldingCellKey,
frontWidget: Builder(
builder: (BuildContext context) {
return GestureDetector(

View File

@@ -3,6 +3,8 @@ import '../screens/countrylist.dart';
import 'package:flutter/material.dart';
class DrawerWidget extends StatelessWidget {
const DrawerWidget({super.key});
@override
Widget build(BuildContext context) {
return Drawer(

View File

@@ -129,13 +129,13 @@ Widget buildInnerBottomWidget(String cases) {
context.findAncestorStateOfType<SimpleFoldingCellState>();
foldingCellState?.toggleFold();
},
child: Text(
"Close",
),
style: TextButton.styleFrom(
foregroundColor: Colors.black,
shape: StadiumBorder(),
overlayColor: Colors.white.withOpacity(0.5),
overlayColor: Colors.white.withValues(alpha: 0.5),
),
child: Text(
"Close",
),
),
],

View File

@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
// this is the rounded rectangle card widget that appears on the homescreen
Widget infoCard(BuildContext context, String title, String number) {
return Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40.0)),
color: Color(0xfff44e3f),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
@@ -25,7 +27,5 @@ Widget infoCard(BuildContext context, String title, String number) {
),
],
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40.0)),
color: Color(0xfff44e3f),
);
}

View File

@@ -35,6 +35,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

View File

@@ -1,12 +1,7 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
@@ -16,23 +11,13 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -1,13 +1,14 @@
import 'package:flutter/material.dart';
class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key);
const HomeScreen({super.key});
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMixin {
class _HomeScreenState extends State<HomeScreen>
with SingleTickerProviderStateMixin {
late final AnimationController _controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 350),
@@ -18,11 +19,14 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
int _counter = 0;
bool _canDragged = false;
void _openCloseDrawer() => _controller.isDismissed ? _controller.forward() : _controller.reverse();
void _openCloseDrawer() =>
_controller.isDismissed ? _controller.forward() : _controller.reverse();
void _onDragStart(DragStartDetails details) {
bool isDragLeft = _controller.isDismissed && details.globalPosition.dx < dragStartPosition;
bool isDragRight = _controller.isCompleted && details.globalPosition.dx > dragStartPosition;
bool isDragLeft = _controller.isDismissed &&
details.globalPosition.dx < dragStartPosition;
bool isDragRight = _controller.isCompleted &&
details.globalPosition.dx > dragStartPosition;
_canDragged = isDragLeft || isDragRight;
}
@@ -38,7 +42,8 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
return;
}
if (details.velocity.pixelsPerSecond.dx.abs() >= 365) {
var visualVelocity = details.velocity.pixelsPerSecond.dx / MediaQuery.of(context).size.width;
var visualVelocity = details.velocity.pixelsPerSecond.dx /
MediaQuery.of(context).size.width;
_controller.fling(velocity: visualVelocity);
} else if (_controller.value < 0.5) {
_controller.reverse();
@@ -66,9 +71,9 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
_homeDrawer(context),
Transform(
transform: Matrix4.identity()
..translate(slide)
..translateByDouble(slide, 0, 0, 1)
..rotateZ(rotate)
..scale(scale),
..scaleByDouble(scale, scale, scale, 1),
alignment: Alignment.centerLeft,
child: _homeView(context),
)

View File

@@ -20,7 +20,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.18.2 <3.0.0'
sdk: ">=3.0.0 <4.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions

View File

@@ -0,0 +1,23 @@
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
linter:
rules:
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -18,6 +18,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"

View File

@@ -1,19 +0,0 @@
package io.flutter.plugins;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.Log;
import io.flutter.embedding.engine.FlutterEngine;
/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
*/
@Keep
public final class GeneratedPluginRegistrant {
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
}
}

View File

@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<StatefulWidget> createState() {
return MyAppState();
@@ -10,7 +12,7 @@ class MyApp extends StatefulWidget {
}
class MyAppState extends State<MyApp> {
List<String> _fruits = ["Apple", "Banana", "Pineapple", "Mango", "Grapes"];
final List<String> _fruits = ["Apple", "Banana", "Pineapple", "Mango", "Grapes"];
late List<DropdownMenuItem<String>> _dropDownMenuItems;
late String _selectedFruit;

View File

@@ -15,6 +15,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
# For information on the generic Dart part of this file, see the

View File

@@ -0,0 +1,23 @@
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
linter:
rules:
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -18,6 +18,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"

View File

@@ -1,19 +0,0 @@
package io.flutter.plugins;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.Log;
import io.flutter.embedding.engine.FlutterEngine;
/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
*/
@Keep
public final class GeneratedPluginRegistrant {
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
}
}

View File

@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {

View File

@@ -15,6 +15,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
# For information on the generic Dart part of this file, see the

View File

@@ -0,0 +1,23 @@
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
linter:
rules:
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -12,6 +12,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View File

@@ -1,19 +0,0 @@
package io.flutter.plugins;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.Log;
import io.flutter.embedding.engine.FlutterEngine;
/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
*/
@Keep
public final class GeneratedPluginRegistrant {
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
}
}

View File

@@ -1,19 +0,0 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GeneratedPluginRegistrant_h
#define GeneratedPluginRegistrant_h
#import <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
@interface GeneratedPluginRegistrant : NSObject
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
@end
NS_ASSUME_NONNULL_END
#endif /* GeneratedPluginRegistrant_h */

View File

@@ -1,14 +0,0 @@
//
// Generated file. Do not edit.
//
// clang-format off
#import "GeneratedPluginRegistrant.h"
@implementation GeneratedPluginRegistrant
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
}
@end

View File

@@ -8,6 +8,8 @@ import './models/transaction.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
@@ -38,6 +40,8 @@ class MyApp extends StatelessWidget {
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
_MyHomePageState createState() => _MyHomePageState();
}
@@ -75,8 +79,8 @@ class _MyHomePageState extends State<MyHomePage> {
builder: (_) {
return GestureDetector(
onTap: () {},
child: NewTransaction(_addNewTransaction),
behavior: HitTestBehavior.opaque,
child: NewTransaction(_addNewTransaction),
);
},
);

View File

@@ -7,7 +7,7 @@ import '../models/transaction.dart';
class Chart extends StatelessWidget {
final List<Transaction> recentTransactions;
Chart(this.recentTransactions);
const Chart(this.recentTransactions, {super.key});
List<Map<String, Object>> get groupedTransactionValues {
return List.generate(7, (index) {

View File

@@ -5,13 +5,13 @@ class ChartBar extends StatelessWidget {
final double spendingAmount;
final double spendingPctOfTotal;
ChartBar(this.label, this.spendingAmount, this.spendingPctOfTotal);
const ChartBar(this.label, this.spendingAmount, this.spendingPctOfTotal, {super.key});
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Container(
SizedBox(
height: 20,
child: FittedBox(
child: Text('\$${spendingAmount.toStringAsFixed(0)}'),
@@ -20,7 +20,7 @@ class ChartBar extends StatelessWidget {
SizedBox(
height: 4,
),
Container(
SizedBox(
height: 60,
width: 10,
child: Stack(

View File

@@ -4,7 +4,7 @@ import 'package:intl/intl.dart';
class NewTransaction extends StatefulWidget {
final Function addTx;
NewTransaction(this.addTx);
const NewTransaction(this.addTx, {super.key});
@override
_NewTransactionState createState() => _NewTransactionState();
@@ -72,7 +72,7 @@ class _NewTransactionState extends State<NewTransaction> {
keyboardType: TextInputType.number,
onSubmitted: (_) => _submitData(),
),
Container(
SizedBox(
height: 70,
child: Row(
children: <Widget>[

View File

@@ -7,11 +7,11 @@ class TransactionList extends StatelessWidget {
final List<Transaction> transactions;
final Function deleteTx;
TransactionList(this.transactions, this.deleteTx);
const TransactionList(this.transactions, this.deleteTx, {super.key});
@override
Widget build(BuildContext context) {
return Container(
return SizedBox(
height: 450,
child: transactions.isEmpty
? Column(
@@ -23,7 +23,7 @@ class TransactionList extends StatelessWidget {
SizedBox(
height: 20,
),
Container(
SizedBox(
height: 200,
child: Image.asset(
'assets/images/waiting.png',

View File

@@ -5,6 +5,8 @@ import './transaction_list.dart';
import '../models/transaction.dart';
class UserTransactions extends StatefulWidget {
const UserTransactions({super.key});
@override
_UserTransactionsState createState() => _UserTransactionsState();
}

View File

@@ -28,6 +28,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
# For information on the generic Dart part of this file, see the

View File

@@ -0,0 +1,23 @@
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
linter:
rules:
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -11,6 +11,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View File

@@ -4,7 +4,7 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart';
main() {
void main() {
WidgetsFlutterBinding.ensureInitialized();
runZonedGuarded(() {
runApp(App());
@@ -15,6 +15,8 @@ main() {
}
class App extends StatelessWidget {
const App({super.key});
//initialise firebase and crashlytics
Future<void> _initializeFirebase() async {
@@ -56,6 +58,8 @@ class App extends StatelessWidget {
}
class CrashApp extends StatelessWidget {
const CrashApp({super.key});
@override
Widget build(BuildContext context) {
return Center(

View File

@@ -34,6 +34,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

View File

@@ -0,0 +1,23 @@
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
linter:
rules:
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -5,6 +5,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View File

@@ -6,7 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
const HomePage({super.key});
@override
_HomePageState createState() => _HomePageState();
@@ -62,7 +62,7 @@ class _HomePageState extends State<HomePage> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
SizedBox(
width: size.width * 0.8,
child: ClipRRect(
borderRadius: BorderRadius.circular(29),
@@ -92,7 +92,7 @@ class _HomePageState extends State<HomePage> {
SizedBox(
height: 15,
),
Container(
SizedBox(
width: size.width * 0.8,
child: ClipRRect(
borderRadius: BorderRadius.circular(29),

View File

@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class InfoPage extends StatefulWidget {
const InfoPage({Key? key}) : super(key: key);
const InfoPage({super.key});
@override
_InfoPageState createState() => _InfoPageState();
@@ -53,7 +53,7 @@ class _InfoPageState extends State<InfoPage> {
height: 15,
),
Text(
user!.email ?? '',
user.email ?? '',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
],

View File

@@ -7,23 +7,28 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
class SignUpPage extends StatefulWidget {
bool isLogin;
SignUpPage(this.isLogin);
final bool isLogin;
const SignUpPage(this.isLogin, {super.key});
@override
_SignUpPageState createState() => _SignUpPageState(isLogin);
State<SignUpPage> createState() => _SignUpPageState();
}
class _SignUpPageState extends State<SignUpPage> {
bool isLogin;
_SignUpPageState(this.isLogin);
late bool isLogin;
@override
void initState() {
super.initState();
isLogin = widget.isLogin;
}
bool loggingIn = false;
TextEditingController email = new TextEditingController();
TextEditingController password = new TextEditingController();
TextEditingController email = TextEditingController();
TextEditingController password = TextEditingController();
bool showPassword = false;
void showSnackBar() {
final snackBar = new SnackBar(
final snackBar = SnackBar(
content: Text('Invalid Credentials!'),
backgroundColor: Colors.red,
padding: EdgeInsets.symmetric(horizontal: 10),
@@ -40,7 +45,7 @@ class _SignUpPageState extends State<SignUpPage> {
final Size size = MediaQuery.of(context).size;
return Scaffold(
body: SingleChildScrollView(
child: Container(
child: SizedBox(
height: size.height,
width: double.infinity,
child: Stack(
@@ -136,7 +141,7 @@ class _SignUpPageState extends State<SignUpPage> {
SizedBox(
height: 30,
),
Container(
SizedBox(
width: size.width * 0.8,
child: ClipRRect(
borderRadius: BorderRadius.circular(29),
@@ -147,11 +152,11 @@ class _SignUpPageState extends State<SignUpPage> {
backgroundColor: Color(0xFF6F35A5),
),
onPressed: () {
String _email = email.text;
String _password = password.text;
String emailText = email.text;
String passwordText = password.text;
!(isLogin)
? signUpClicked(_email, _password, context)
: loginClicked(_email, _password, context);
? signUpClicked(emailText, passwordText, context)
: loginClicked(emailText, passwordText, context);
},
child: Text(
(isLogin) ? 'Login' : 'SignUp',
@@ -166,7 +171,7 @@ class _SignUpPageState extends State<SignUpPage> {
SizedBox(
height: 18,
),
Container(
SizedBox(
width: size.width * 0.81,
child: ClipRRect(
borderRadius: BorderRadius.circular(29),
@@ -181,6 +186,7 @@ class _SignUpPageState extends State<SignUpPage> {
context,
listen: false);
provider.googleLogin().then((value) {
if (!context.mounted) return;
Navigator.popUntil(
context, (route) => route.isFirst);
}).catchError((onError) {
@@ -242,14 +248,15 @@ class _SignUpPageState extends State<SignUpPage> {
);
}
signUpClicked(String _email, String _password, BuildContext context) {
void signUpClicked(String email, String password, BuildContext context) {
FirebaseAuth.instance
.createUserWithEmailAndPassword(email: _email, password: _password)
.createUserWithEmailAndPassword(email: email, password: password)
.then((value) {
setState(() {
loggingIn = true;
});
Future.delayed(Duration(seconds: 1, milliseconds: 50), () {
if (!context.mounted) return;
Navigator.popUntil(context, (route) => route.isFirst);
});
}).catchError((e) {
@@ -257,14 +264,15 @@ class _SignUpPageState extends State<SignUpPage> {
});
}
bool loginClicked(String _email, String _password, BuildContext context) {
bool loginClicked(String email, String password, BuildContext context) {
FirebaseAuth.instance
.signInWithEmailAndPassword(email: _email, password: _password)
.signInWithEmailAndPassword(email: email, password: password)
.then((value) {
setState(() {
loggingIn = true;
});
Future.delayed(Duration(seconds: 1, milliseconds: 50), () {
if (!context.mounted) return;
Navigator.pop(context);
});
}).catchError((e) {

View File

@@ -15,10 +15,9 @@ class GoogleSignInProvider extends ChangeNotifier {
try {
await googleSignIn.initialize();
final googleUser = await googleSignIn.authenticate();
if (googleUser == null) return;
_user = googleUser;
final googleAuth = await googleUser.authentication;
final googleAuth = googleUser.authentication;
final credentials = GoogleAuthProvider.credential(
idToken: googleAuth.idToken,

View File

@@ -11,7 +11,7 @@ void main() async{
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});
@override
Widget build(BuildContext context) {

View File

@@ -40,6 +40,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

View File

@@ -1,12 +1,7 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# Lint rules for Flutter apps.
# See https://dart.dev/guides/language/analysis-options
include: package:flutter_lints/flutter.yaml
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
@@ -16,23 +11,13 @@ analyzer:
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
# Noise in small sample apps; keep the code readable.
avoid_print: false
avoid_unnecessary_containers: false
file_names: false
library_private_types_in_public_api: false
non_constant_identifier_names: false
strict_top_level_inference: false

View File

@@ -6,7 +6,7 @@ plugins {
}
android {
namespace = "com.example.getx_counter_app"
namespace = "github.nisrulz.getx_counter_app"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
@@ -16,7 +16,7 @@ android {
}
defaultConfig {
applicationId = "com.example.getx_counter_app"
applicationId = "github.nisrulz.getx_counter_app"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode

View File

@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.getx_counter_app">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

View File

@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.getx_counter_app">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->

Some files were not shown because too many files have changed in this diff Show More