Skip to content

Commit

Permalink
Merge branch 'main' of github.com:bulgariamitko/flutterflowtutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
bulgariamitko committed Mar 22, 2024
2 parents 11e6d3c + d310e3e commit 237bbd9
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 73 deletions.
22 changes: 10 additions & 12 deletions Source-Code/ff_source_code/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services" // Google Services plugin


}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +15,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -21,12 +25,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services' // Google Services plugin


def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
Expand Down Expand Up @@ -78,5 +76,5 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
}
15 changes: 0 additions & 15 deletions Source-Code/ff_source_code/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8' // Google Services plugin

}
}

allprojects {
repositories {
google()
Expand Down
42 changes: 22 additions & 20 deletions Source-Code/ff_source_code/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.google.gms.google-services" version "4.4.0" apply false // Google Services plugin

}

plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
include ":app"
15 changes: 15 additions & 0 deletions Source-Code/ff_source_code/lib/backend/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,21 @@ Future<List<T>> queryCollectionOnce<T>(
.toList());
}

extension FilterExtension on Filter {
Filter filterIn(String field, List? list) => (list?.isEmpty ?? true)
? Filter(field, whereIn: null)
: Filter(field, whereIn: list);

Filter filterNotIn(String field, List? list) => (list?.isEmpty ?? true)
? Filter(field, whereNotIn: null)
: Filter(field, whereNotIn: list);

Filter filterArrayContainsAny(String field, List? list) =>
(list?.isEmpty ?? true)
? Filter(field, arrayContainsAny: null)
: Filter(field, arrayContainsAny: list);
}

extension QueryExtension on Query {
Query whereIn(String field, List? list) => (list?.isEmpty ?? true)
? where(field, whereIn: null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,32 @@ class _FFButtonWidgetState extends State<FFButtonWidget> {
bool loading = false;

int get maxLines => widget.options.maxLines ?? 1;
String? get text =>
widget.options.textStyle?.fontSize == 0 ? null : widget.text;

@override
Widget build(BuildContext context) {
Widget textWidget = loading
? SizedBox(
width: widget.options.width == null
? _getTextWidth(widget.text, widget.options.textStyle, maxLines)
? _getTextWidth(text, widget.options.textStyle, maxLines)
: null,
child: Center(
child: SizedBox(
width: 23,
height: 23,
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
widget.options.textStyle!.color ?? Colors.white,
widget.options.textStyle?.color ?? Colors.white,
),
),
),
),
)
: AutoSizeText(
widget.text,
style: widget.options.textStyle?.withoutColor(),
text ?? '',
style:
text == null ? null : widget.options.textStyle?.withoutColor(),
maxLines: maxLines,
overflow: TextOverflow.ellipsis,
);
Expand Down Expand Up @@ -145,7 +148,7 @@ class _FFButtonWidgetState extends State<FFButtonWidget> {
widget.options.hoverTextColor != null) {
return widget.options.hoverTextColor;
}
return widget.options.textStyle?.color;
return widget.options.textStyle?.color ?? Colors.white;
},
),
backgroundColor: MaterialStateProperty.resolveWith<Color?>(
Expand Down Expand Up @@ -175,25 +178,48 @@ class _FFButtonWidgetState extends State<FFButtonWidget> {
widget.options.hoverElevation != null) {
return widget.options.hoverElevation!;
}
return widget.options.elevation;
return widget.options.elevation ?? 2.0;
},
),
);

if ((widget.icon != null || widget.iconData != null) && !loading) {
Widget icon = widget.icon ??
FaIcon(
widget.iconData!,
size: widget.options.iconSize,
color: widget.options.iconColor,
);

if (text == null) {
return Container(
height: widget.options.height,
width: widget.options.width,
decoration: BoxDecoration(
border: Border.fromBorderSide(
widget.options.borderSide ?? BorderSide.none,
),
borderRadius:
widget.options.borderRadius ?? BorderRadius.circular(8),
),
child: IconButton(
splashRadius: 1.0,
icon: Padding(
padding: widget.options.iconPadding ?? EdgeInsets.zero,
child: icon,
),
onPressed: onPressed,
style: style,
),
);
}
return SizedBox(
height: widget.options.height,
width: widget.options.width,
child: ElevatedButton.icon(
icon: Padding(
padding: widget.options.iconPadding ?? EdgeInsets.zero,
child: widget.icon ??
FaIcon(
widget.iconData,
size: widget.options.iconSize,
color: widget.options.iconColor ??
widget.options.textStyle!.color,
),
child: icon,
),
label: textWidget,
onPressed: onPressed,
Expand All @@ -202,7 +228,7 @@ class _FFButtonWidgetState extends State<FFButtonWidget> {
);
}

return Container(
return SizedBox(
height: widget.options.height,
width: widget.options.width,
child: ElevatedButton(
Expand Down Expand Up @@ -247,11 +273,13 @@ extension _WithoutColorExtension on TextStyle {
}

// Slightly hacky method of getting the layout width of the provided text.
double _getTextWidth(String text, TextStyle? style, int maxLines) =>
(TextPainter(
text: TextSpan(text: text, style: style),
textDirection: TextDirection.ltr,
maxLines: maxLines,
)..layout())
.size
.width;
double? _getTextWidth(String? text, TextStyle? style, int maxLines) =>
text != null
? (TextPainter(
text: TextSpan(text: text, style: style),
textDirection: TextDirection.ltr,
maxLines: maxLines,
)..layout())
.size
.width
: null;
8 changes: 4 additions & 4 deletions Source-Code/ff_source_code/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ dependencies:
video_player_avfoundation: 2.5.1
video_player_platform_interface: 6.2.1
video_player_web: 2.1.2
webview_flutter: 4.4.4
webview_flutter_android: 3.13.2
webview_flutter_platform_interface: 2.9.1
webview_flutter_wkwebview: 3.10.2
webview_flutter: 4.7.0
webview_flutter_android: 3.15.0
webview_flutter_platform_interface: 2.10.0
webview_flutter_wkwebview: 3.12.0


# The following adds the Cupertino Icons font to your application.
Expand Down

0 comments on commit 237bbd9

Please sign in to comment.