Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image does not span across width #338

Closed
fedeakd opened this issue Jun 25, 2020 · 3 comments
Closed

Image does not span across width #338

fedeakd opened this issue Jun 25, 2020 · 3 comments

Comments

@fedeakd
Copy link

fedeakd commented Jun 25, 2020

Hello don't full width
I need the image to expand as much as possible, but I can't get it, how can I do that?

> import 'package:flutter/material.dart';
> import 'package:flutter_html/flutter_html.dart';
> import 'package:flutter_html/html_parser.dart';
> import 'package:flutter_html/style.dart';
> import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
> 
> void main() {
>   runApp(MyApp());
> }
> 
> const htmlComplete = """
>     <img src="http://www.elprimergrande.com/wp-content/uploads/2018/03/28879902_10211522338599417_2002776939_o.png" >
> 
>     <h2>Racing club el   primessr  grande </h2>
>     """;
> 
> class MyApp extends StatelessWidget {
>   // This widget is the root of your application.
>   @override
>   Widget build(BuildContext context) {
>     return MaterialApp(
>         builder: (BuildContext context, Widget child) => MediaQuery(
>               data: MediaQuery.of(context).copyWith(textScaleFactor: 1),
>               child: child,
>             ),
>         title: 'Flutter Demo',
>         home: new Scaffold(
>             appBar: AppBar(
>               title: Text('flutter_html Example'),
>               centerTitle: true,
>             ),
>             body: SizedBox.expand(
>                 child: Container(
>                     margin: const EdgeInsets.only(left: 0.0, right: 0.0),
>                     child: Html(
>                       shrinkWrap: false,
>                       style: {
>                         "html": Style(
>                           alignment: Alignment.bottomRight,
>                           margin: const EdgeInsets.only(left: 0.0, right: 0.0),
>                           backgroundColor: Colors.red,
> //              color: Colors.white,
>                         ),
>                         "image": Style(
>                             backgroundColor: Colors.white, width: 1000000),
>                       },
>                       data: htmlComplete,
>                     )))));
>   }
> 

image

@erickok
Copy link
Collaborator

erickok commented Jun 25, 2020

See #329. Your HTML content is implicitly wrapped in a body that has a padding by default. You can zero that out.

@fedeakd
Copy link
Author

fedeakd commented Jun 25, 2020

if that was indeed it, I couldn't find it before, thanks

@ryan-berger
Copy link
Collaborator

@fedeakd Yup, @erickok is correct. I'll close this one out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants