Commit 5c2b6d39 by Karthik Ponnam

v3.1.1

parent 893e9e4d
......@@ -40,5 +40,5 @@ android {
}
dependencies {
// implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.core:core:1.0.2'
// implementation 'androidx.core:core:1.0.2'
}
......@@ -4,7 +4,6 @@ import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import androidx.core.content.res.ResourcesCompat;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
......@@ -44,49 +43,51 @@ public class FluttertoastPlugin implements MethodCallHandler {
Number textcolor = call.argument("textcolor");
Number textSize = call.argument("fontSize");
if(bgcolor != null && textcolor != null && textSize != null) {
LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.toast_custom, null);
LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.toast_custom, null);
TextView text = layout.findViewById(R.id.text);
TextView text = layout.findViewById(R.id.text);
toast = new Toast(ctx);
toast = new Toast(ctx);
if (length.equals("long")) {
toast.setDuration(Toast.LENGTH_LONG);
} else {
toast.setDuration(Toast.LENGTH_SHORT);
}
if (length.equals("long")) {
toast.setDuration(Toast.LENGTH_LONG);
} else {
toast.setDuration(Toast.LENGTH_SHORT);
}
text.setText(msg);
text.setText(msg);
toast.setView(layout);
toast.setView(layout);
switch (gravity) {
case "top":
toast.setGravity(Gravity.TOP, 0, 100);
break;
case "center":
toast.setGravity(Gravity.CENTER, 0, 0);
break;
default:
toast.setGravity(Gravity.BOTTOM, 0, 100);
}
switch (gravity) {
case "top":
toast.setGravity(Gravity.TOP, 0, 100);
break;
case "center":
toast.setGravity(Gravity.CENTER, 0, 0);
break;
default:
toast.setGravity(Gravity.BOTTOM, 0, 100);
}
if (textSize != null)
text.setTextSize(textSize.floatValue());
if (textSize != null)
text.setTextSize(textSize.floatValue());
Drawable shapeDrawable;
Drawable shapeDrawable;
// shapeDrawable = ctx.getDrawable(ctx.getResources(), R.drawable.toast_bg, null);
shapeDrawable = ResourcesCompat.getDrawable(ctx.getResources(), R.drawable.toast_bg, null);
shapeDrawable = ctx.getResources().getDrawable(R.drawable.toast_bg);
if (bgcolor != null && shapeDrawable != null) {
shapeDrawable.setColorFilter(bgcolor.intValue(), PorterDuff.Mode.SRC_IN);
}
if (bgcolor != null && shapeDrawable != null) {
shapeDrawable.setColorFilter(bgcolor.intValue(), PorterDuff.Mode.SRC_IN);
}
layout.setBackground(shapeDrawable);
layout.setBackground(shapeDrawable);
// if(bgcolor != null) {
// Drawable shapeDrawable;
......@@ -107,11 +108,24 @@ public class FluttertoastPlugin implements MethodCallHandler {
// }
// }
if (textcolor != null) {
text.setTextColor(textcolor.intValue());
if (textcolor != null) {
text.setTextColor(textcolor.intValue());
}
toast.show();
} else {
int toastLength;
if (length.equals("long")) {
toastLength = Toast.LENGTH_LONG;
} else {
toastLength = Toast.LENGTH_SHORT;
}
Toast toast = Toast.makeText(ctx, msg, toastLength);
toast.show();
}
toast.show();
result.success(true);
break;
......
......@@ -8,7 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
......
#Mon Feb 25 01:11:37 IST 2019
#Wed Aug 28 13:18:11 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: camel_case_types
// ignore_for_file: prefer_single_quotes
//This file is automatically generated. DO NOT EDIT, all your changes would be lost.
class S implements WidgetsLocalizations {
const S();
static const GeneratedLocalizationsDelegate delegate =
GeneratedLocalizationsDelegate();
static S of(BuildContext context) => Localizations.of<S>(context, S);
@override
TextDirection get textDirection => TextDirection.ltr;
}
class en extends S {
const en();
}
class GeneratedLocalizationsDelegate extends LocalizationsDelegate<S> {
const GeneratedLocalizationsDelegate();
List<Locale> get supportedLocales {
return const <Locale>[
Locale("en", ""),
];
}
LocaleListResolutionCallback listResolution({Locale fallback}) {
return (List<Locale> locales, Iterable<Locale> supported) {
if (locales == null || locales.isEmpty) {
return fallback ?? supported.first;
} else {
return _resolve(locales.first, fallback, supported);
}
};
}
LocaleResolutionCallback resolution({Locale fallback}) {
return (Locale locale, Iterable<Locale> supported) {
return _resolve(locale, fallback, supported);
};
}
Locale _resolve(Locale locale, Locale fallback, Iterable<Locale> supported) {
if (locale == null || !isSupported(locale)) {
return fallback ?? supported.first;
}
final Locale languageLocale = Locale(locale.languageCode, "");
if (supported.contains(locale)) {
return locale;
} else if (supported.contains(languageLocale)) {
return languageLocale;
} else {
final Locale fallbackLocale = fallback ?? supported.first;
return fallbackLocale;
}
}
@override
Future<S> load(Locale locale) {
final String lang = getLang(locale);
if (lang != null) {
switch (lang) {
case "en":
return SynchronousFuture<S>(const en());
default:
// NO-OP.
}
}
return SynchronousFuture<S>(const S());
}
@override
bool isSupported(Locale locale) =>
locale != null && supportedLocales.contains(locale);
@override
bool shouldReload(GeneratedLocalizationsDelegate old) => false;
}
String getLang(Locale l) => l == null
? null
: l.countryCode != null && l.countryCode.isEmpty
? l.languageCode
: l.toString();
name: fluttertoast
description: Toast Library for FLutter
version: 3.1.0
version: 3.1.1
author: Karthik Ponnam <ponnamkarthik3@gmail.com>
homepage: https://github.com/PonnamKarthik/FlutterToast
......@@ -10,7 +10,7 @@ environment:
dependencies:
flutter:
sdk: flutter
meta: ^1.1.6
meta: ^1.1.7
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment