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

TextDecoration.lineThrough bug #17

Open
pavel-birdy opened this issue Dec 13, 2019 · 6 comments
Open

TextDecoration.lineThrough bug #17

pavel-birdy opened this issue Dec 13, 2019 · 6 comments
Assignees
Labels
flutter framework bug This has been identified as a bug in the flutter framework, and an issue has been filed p: google_fonts

Comments

@pavel-birdy
Copy link

pavel-birdy commented Dec 13, 2019

TextDecoration.lineThrough showing the line at the bottom of the text. It used to be (using assets font) at the center. I switched back to the assets font and it's working perfectly.

@johnsonmh
Copy link
Contributor

Can you share a reproducible example? I tried with the following demo code, and it seems to work as expected for me.

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData.light(),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          'Flutter Demo Home Page',
          style: GoogleFonts.biryani(fontWeight: FontWeight.w900, fontStyle: FontStyle.italic),
        ),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
              style: GoogleFonts.tomorrow().copyWith(decoration: TextDecoration.lineThrough),
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}

Simulator Screen Shot - iPhone 11 Pro Max - 2019-12-13 at 11 33 22

@pavel-birdy
Copy link
Author

I am sorry I didn't try other fonts. I found this issue with the font I am using in my project. Not sure if the bug is font specific?

Text(
              'You have pushed the button this many times:',
              style: GoogleFonts.asap()
                  .copyWith(decoration: TextDecoration.lineThrough),
            ),

photo_2019-12-13_22-23-38

@pavel-birdy
Copy link
Author

pavel-birdy commented Dec 13, 2019

Here using assets fonts. Which is normal.

photo_2019-12-13_22-34-45

@johnsonmh
Copy link
Contributor

Ah ok, I was able to reproduce the bug as you defined it above. It's oddly specific. It only occurs for this font (as far as I've found), and it only occurs on android devices. And when you download the exact same ttf from this link: http://fonts.gstatic.com/s/asap/v11/KFOoCniXp96a-zwU4UROGzY.ttf, and put it in the pubspec, it works as expected. Something may be going weird with the FontLoader, I think we'll have to file a bug with the flutter framework to point out the odd behavior of the FontLoader with this particular font file.

@pavel-birdy
Copy link
Author

Any update?

@johnsonmh johnsonmh assigned johnsonmh and unassigned johnsonmh Jan 21, 2020
@johnsonmh
Copy link
Contributor

This seems to be a bug in the FontLoader. It only happens with this specific font, and only on Android, and only when used with the FontLoader.

I've filed flutter/flutter#49239 to the flutter/flutter repo, hopefully this will get resolved there.

@johnsonmh johnsonmh added the flutter framework bug This has been identified as a bug in the flutter framework, and an issue has been filed label Nov 15, 2021
guidezpl added a commit that referenced this issue Feb 2, 2023
guidezpl pushed a commit that referenced this issue Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flutter framework bug This has been identified as a bug in the flutter framework, and an issue has been filed p: google_fonts
Projects
None yet
Development

No branches or pull requests

3 participants