Matrix for HDR-ISH - image

I went to create HDR-ISH filter for flutter application. Anyone help me to find matrix for HDR-ISH image? I need Matrix like below code
Container(
child: Center(
child: ColorFiltered(
colorFilter: ColorFilter.matrix([
0.9,0.5,0.1,0.0,0.0,
0.3,0.8,0.1,0.0,0.0,
0.2,0.3,0.5,0.0,0.0,
0.0,0.0,0.0,1.0,0.0
]),
child: Image.asset("assets/sample.png"))),
),
);

Related

Can't load image in stack in flutter

I want to load image in my app
in stack
but image not load
I don't have an error
I've add image in pubspec and pub it .
this is part of my code :
InkWell(
child: Stack(
children: <Widget>[
new Image.asset('assets/Images/b.jpg',fit: BoxFit.cover,),
Center(child: Text("something",textAlign: TextAlign.center,)),
]
),
onTap: () {
ListOfEpisode();
print("am");
},
),
I've try it with network image but still not work.
anyone know that why i can't loaded ?
Change it towercase i:
new Image.asset('assets/images/b.jpg',fit: BoxFit.cover,),
In your pubespec you have it assets/images, in your code it's Images. Fix one of them.
Path in your directory and pubsec is:
assets/images/b.jpg
But in your code its:
assets/Images/b.jpg
change path in code to:
assets/images/b.jpg

Can't set Network Image with error "Exception caught by image resource service ..."

Similar types of problems already on this site but in my case, it is different.
Please, take a look at my code and the error. I can't understand the error.
Here is a part of my code which is causing the error:
....
....
GridTile(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(feedbackItems[index].name),
Expanded(
child: Image.network(
'${feedbackItems[index].photo}'),
),
],
))
....
....
Here is the error:
Please try this.
Container(
height:100,width:100 // you can give height and width there
child: Image.network(
'${feedbackItems[index].photo}', fit: BoxFit.fill,),
),
BASELINK = 'http://xxxx.com/asset/images/'; //defined baselink
Container(
height:100,width:100 // you can give height and width there
child: Image.network(
BASELINK+'${feedbackItems[index].photo}', fit: BoxFit.fill,),
),
use this.
flutter run -d chrome --web-renderer html

Flutter Duration User Input

In my app I need the user to give me a duration, I am thinking about seconds and minutes. So after pressing a button i want something like a Pop-Up Window in which the user then can select a duration by scrolling through a list and picking the minutes and seconds (or something similar to that).
After a long internet search I can't find any template which does something like that and I really don't want to code everything by hand. I would appreciate a link to a template and if not maybe suggestions on what would be the right way to do something like that.
You can use flutter_picker package for this.
Following snippet shows an example that takes hours and minutes input from the user:
void onTap() {
Picker(
adapter: NumberPickerAdapter(data: <NumberPickerColumn>[
const NumberPickerColumn(begin: 0, end: 999, suffix: Text(' hours')),
const NumberPickerColumn(begin: 0, end: 60, suffix: Text(' minutes'), jump: 15),
]),
delimiter: <PickerDelimiter>[
PickerDelimiter(
child: Container(
width: 30.0,
alignment: Alignment.center,
child: Icon(Icons.more_vert),
),
)
],
hideHeader: true,
confirmText: 'OK',
confirmTextStyle: TextStyle(inherit: false, color: Colors.red, fontSize: 22),
title: const Text('Select duration'),
selectedTextStyle: TextStyle(color: Colors.blue),
onConfirm: (Picker picker, List<int> value) {
// You get your duration here
Duration _duration = Duration(hours: picker.getSelectedValues()[0], minutes: picker.getSelectedValues()[1]);
},
).showDialog(context);
}

Change the primary image dimension without touching placeholder image size in Flutter

I have a little question about image and preloading in flutter :
How to change the fit value to cover of an image without touching the size of the placeholder ?
Widget primaryVideoImg(img) {
return Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
child: GestureDetector(
child: FadeInImage.assetNetwork(
placeholder: 'res/preloader.gif',
image: 'remote image url',
fit: BoxFit.fill,
)))
],
);
}
As you see in the picture bellow the placeholder take also the whole page.
You can use Stack and some transparent image for placeholder in FadeInImage.assetNetwork to achieve what you want.
For your code it will look something like this:
import 'package:transparent_image/transparent_image.dart';
...
Stack(children: <Widget>[
new Image.asset('res/preloader.gif', fit: BoxFit.fill),
FadeInImage.assetNetwork(
placeholder: kTransparentImage,
image: 'remote image url',
fit: BoxFit.cover,
),
],
);
You can make your own transparent image and attach it to the project.
Or use kTransparentImage presented in transparent_image 0.1.0 plugin:
https://pub.dartlang.org/packages/transparent_image
I find this trick in Flutter cookbook.
For more information look on this link:
https://flutter.io/docs/cookbook/images/fading-in-images
Good Luck!

How do I pass an Internationalization Object to Child Widgets in Flutter

Just getting started with Flutter/dart, transitioning for PHP, and struggling to figure out how to pass classes into widgets.
I am working on creating my first android and iOS applications using flutter.
I am working with internationalization and everything works fine at my initial build page using the internationalization class I have. However, when passing it on to another widget I get:
NoSuchMethodError: The getter textTitle was called on null.
Receiver: null
tried calling: textTitle
What is the best way of handling this?
Flutter Doctor
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D47, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.1)
[✓] Android Studio (version 3.0)
[✓] Connected devices (1 available)
Localization dart
class HnLocalizations{
HnLocalizations(this.locale);
final Locale locale;
static HnLocalizations of(BuildContext context){
return Localizations.of<HnLocalizations>(context, HnLocalizations);
}
static Map<String, Map<String, String>> _localizedValues = {
'en': {
'btnLabelLoginS1': 'Login',
'btnLabelRegisterS1': 'Sign Up'
},
;
String get s1ButtonLabelLogin =>
_localizedValues[locale.languageCode]['btnLabelLoginS1'];
class HnLocalizationsDelegate extends LocalizationsDelegate<HnLocalizations> {
const HnLocalizationsDelegate();
#override
bool isSupported(Locale locale) => ['en', 'es'].contains(locale.languageCode);
#override
Future<HnLocalizations> load(Locale locale) =>
new SynchronousFuture<HnLocalizations>(new HnLocalizations(locale)); //HnLocalizations.load(locale);
#override
bool shouldReload(HnLocalizationsDelegate old) => false;
}
Main Dart
void main() {
runApp(new MaterialApp(
localizationsDelegates: [
const HnLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('en', 'US'), /// Americans
const Locale('en', 'GB') /// Brits
],
title: 'HN',
home: new EntryPage(),
));
}
class EntryPage extends StatelessWidget {
final HnColors _hnColors = new HnColors();
#override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
// !!!**** THIS WORKS AS EXPECTED ****!!!!
title: new Text(HnLocalizations.of(context).s1ButtonLabelLogin),
backgroundColor: _hnColors.transparent(),
elevation: 0.0,
),
backgroundColor: _hnColors.accent(),
body: new Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage("assets/Background_World.png"),
fit: BoxFit.fitWidth,
),
),
child: new PanelArea(),
)
);
}
}
class PanelArea extends StatelessWidget {
#override
Widget build(BuildContext context) {
HnColors _hnColors = new HnColors();
return new Container(
child: new Center(
child: new Container(
decoration: new BoxDecoration(
borderRadius: new BorderRadius.circular(15.0),
color: _hnColors.transparent()
),
child: new Column(
children: [
new Image.asset('assets/Icon_Intro_login'),
new Text(
// !!!**** ERROR IS HERE ****!!!!
HnLocalizations.of(context).s1M1HeaderTitle,
style: new TextStyle(
color: _haillioColors.white()
),
),
What is the best way of handling this?
Update: Mar 11 2018
I've discovered that if I move all of the code into the main.dart file. All localization works fine. However, when I move my widgets into a separate dart file, the errors come back, even though all of the code is the same.
Update: Mar 12 2018
nicolás-carrasco pointed in the right direction by a reference in this post (Thank you). The problem had to do with imports which is addressed in this post here which ended up being the solution that worked for me. The example is added below in answers.
Nicolás Carrasco pointed towards a solution which was related to what was causing the problem for me by way of link to this post.
In the localization.dart file imports I had:
import 'package:hn/hnLocalization.dart';
While in the main.dart file imports I had:
import 'hnLocalization.dart';
These are not the same thing as described here
Making sure that all files are imported using relative paths vs packages resolved the problem. The distinction is that my files, not the dependencies use relative path. That part stumped at first.
Now my localization.dart file has the following.
import 'hnLocalization.dart'; // <--- Using relative Path
class PanelArea extends StatelessWidget {
#override
Widget build(BuildContext context) { ...
child: new Column(
children: [
new Image.asset('assets/Icon_Intro_login'),
// This Now Works --->
new Text(HnLocalizations.of(context).s1M1HeaderTitle,
]
...
and all is right now.

Resources