Why can't I print out an image on flutter? - error-handling

By using the following code, I'm unable to print out the same results as the example I've listed. Does anyone know why?
My code What I'm actually gettingWhat it should look like

First, ensure that you added the reference of your image inside the file pubspec.yaml (I guess you have a typo btw -> assets instead of assests
flutter:
assets:
- assets/vegetables.jpg
After that I added some properties to your Column widget
mainAxisSize: MainAxisSize.min,
To avoid your Column fill all the space in vertical, it's like wrap_content in Android
crossAxisAlignment: CrossAxisAlignment.stretch
To expand the child full width.
textAlign: TextAlign.center
To align the text to the center
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("FBLA Quizz!!"),
),
body: Card(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Image.asset("assets/vegetables.jpg"),
Text(
"Food Paradise",
textAlign: TextAlign.center,
)
],
),
),
);
}

Related

Google map Marker Clustering marker count getting merged with another Cluster

I have done Marker Clustering in my Vue js application. And the cluser icon is custom made. But there is a problem.
import { MarkerClusterer } from '#googlemaps/markerclusterer';
this.markerCluster = new MarkerClusterer({
map,
markers,
renderer: {
render: ({ markers, _position: position }) => {
return new vm.google.maps.Marker({
position: {
lat: position.lat(),
lng: position.lng()
},
zIndex: 1,
icon: require('#/assets/marker-clusterer.svg'),
label: {
text: String(markers.length),
color: 'white',
fontSize: '13px',
fontFamily: 'Lato-Reqular,sans-serif'
}
})
}
}
})
Anyone had the experience like this? The issue is, when the map just moved the cluster counts getting merged and can't read the count(See the first screenshot). Once the map just zoom in or zoom out, then the count become ok (Screenshot 2).
I'm looking for the solution to avoid the merging of the Cluster count in the first screenshot.
Anyone can help me on this? Thanks in advance.

How to change react-native-mathjax default background white color?

I want to change the background color of the MathJax component. How can I do it? I tried few different solution but they won't work for me. I added custom style for 'mathJaxOptions' but it will changed only formula area color.
My code as follows, please help me to resolve this problem.
const mmlOptions = {
styles: {
'#formula': {
'background-color': '#212121',
color: '#000000',
padding: 8,
},
},
messageStyle: 'none',
extensions: ['tex2jax.js'],
jax: ['input/TeX', 'output/HTML-CSS'],
tex2jax: {
inlineMath: [
['$', '$'],
['\\(', '\\)'],
],
displayMath: [
['$$', '$$'],
['\\[', '\\]'],
],
processEscapes: true,
},
TeX: {
extensions: ['AMSmath.js', 'AMSsymbols.js', 'noErrors.js', 'noUndefined.js'],
},
};
<MathJax
html={props?.tnode?.init?.domNode?.children[0].data}
mathJaxOptions={mmlOptions}
hasIframe={true}
enableBaseUrl={true}
color={'red'}
/>
change the background color of react-native-mathjax library

How do you apply a custom font when using Stripe in Vue? vue-stripe-elements-plus

I'm using the vue-stripe-elements-plus NPM module and I can't see how to add a custom font?
This plugin uses the options you pass in to the first element you create for creating the VUE elements.
It passes the style object to the style option when Stripe creates elements.
It passes the elements property to Stripe's elements function.
In here you can add a CustomFontSource object.
Please note, as in this example, if you want to use a Google font, you have to go to the URL provided and grab the URL within the #fontface descriptors. You would probably be better of hosting the font yourself as I fear these URLs may change over time.
stripeOptions: {
elements: {
fonts: [{
family: 'Lexend Deca',
src: 'url(https://fonts.gstatic.com/s/lexenddeca/v1/K2F1fZFYk-dHSE0UPPuwQ5qnJy_YZ2ON.woff2)',
unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',
style: 'normal',
weight: '400',
display: 'swap',
}],
},
style: {
base: {
color: 'red',
fontFamily: '"Lexend Deca", sans-serif',
fontSize: '18px',
fontWeight: '400',
fontSmoothing: 'antialiased',
},
},
},
Stripe components:
<card-number
:stripe="stripeId"
:options="stripeOptions"
/>
<card-expiry
:stripe="stripeId"
:options="stripeOptions"
/>
<card-cvc
:stripe="stripeId"
:options="stripeOptions"
/>

Style teaching bubble with different background color than it's coachmark

I am using a teaching bubble inside a coach mark, same as the example in here
enter link description here
How can I have the teaching bubble in white instead of blue?
You can pass in the styles prop to the TeachingBubbleContent that contain this object:
{
closeButton: {
color: 'red',
selectors: {
':hover': {
background: 'gainsboro',
color: 'red'
},
':active': {
background: 'darkGray',
color: 'red'
}
}
},
content: {
border: '1px solid black',
background: 'white',
},
headline: {
color: 'black'
},
subText: {
color: 'black'
}
}
Example here in this codepen: https://codepen.io/vitalius1/pen/xoEPzg.
The only thing thing you can't do easily is to change the Coachmark's drop color in a way that is still visible. You can try by passing color prop to it and specify white, but because there is no border or shadow around the drop all you'll see is the beacon animation. And if you try give it a border it won't look nice (see codepen) because of how the drop is constructed. Also, there is currently a bug in passing the beaconColorOne and beaconColorTwo props to change the beacon color that I am fixing right now :)
Hope that helps!

flutter Dismissible widget variable dependency

Edit: Fixed it.. Look down
Old problem:
I am experimenting with the Dismissible widget.
I can successfully monitor the state of the direction, which is stored in directionVar.
It outputs something like DismissDirection.endToStart
I want to use this information, to change the placement of the icon that I show.
When removing an item, the background is red, with an icon on the right to it. Something in the style like Gmail.
Widget build(BuildContext context) {
DismissDirection directionVar;
return ListView.builder(
itemBuilder: (BuildContext context, int index) {
return Dismissible(
key: Key(products[index]['title']), //Should be unique.
onDismissed: (DismissDirection direction) {
directionVar = direction;
},
My issue is this part:
background: Container(
color: Colors.red,
padding: EdgeInsets.only(left: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Icon(
Icons.delete,
)
],
),
),);});}
I want this part to change dependent on the directionVar value.
The padding should change dependent on the value of directionVar, together with the mainAxisAlignment.
Something along these lines:
if(directionVar == DismissDirection.endToStart){
} else if (directionVar == DismissDirection.startToEnd){
}
But I can't access the background: and padding property in these statements, since they are a property of the Dismissible widget and can't be changed inside onDismissed(){}
This seems like simple problem but can't seem to solve it.
Edit: Fixed it.. Very easy.. Just added this:
secondaryBackground: Container(
color: Colors.red,
padding: EdgeInsets.only(right: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Icon(
Icons.delete,
)
],
),
),
There are a few ways that you can achieve this. For example, you can create a method that handles the direction dynamically and then update it accordingly in your widget tree. Something like
List<dynamic> _resolveDirection(DismissDirection direction) {
switch (direction) {
case DismissDirection.endToStart:
return [MainAxisAlignment.center, 20.0];
break;
case DismissDirection.startToEnd:
return [MainAxisAlignment.start, 10.0];
break;
case DismissDirection.vertical:
return [MainAxisAlignment.end, 5.0];
break;
// And so on...
default:
return [];
}
}
and then replace your tree with
background: Container(
color: Colors.red,
padding: _resolveDirection(directionVar)[1],
child: Row(
mainAxisAlignment: _resolveDirection(directionVar)[0],
children: <Widget>[
Icon(
Icons.delete,
)
],
),
),);});}
In the end, all you have to do everytime a swipe occurs, is just rebuild your tree with the direction updated
setState(() => directionVar = direction);