Current Time 0:00
/
Duration Time 0:00
Progress: NaN%
Playback Rate
1.00x
Closed Caption

Add Custom Fonts

Code

https://github.com/tinycasts/notee/tree/feature/episode_05

Snippets

lib/themes/default.dart

class LayoutThemeState extends State<LayoutTheme> {
   ...
   AppText get text => AppText(colors: colors);
}

lib/themes/text.dart

import 'package:flutter/material.dart';
import 'package:notee/themes/colors.dart';

class AppText {
  final AppColors colors;

  AppText({ this.colors });

  TextStyle get title => TextStyle(
    fontFamily: 'Manrope',
    fontWeight: FontWeight.bold,
    fontSize: 50,
    color: colors.blackHaze
  );
}

main.dart

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        decoration: BoxDecoration(
          gradient: LayoutTheme.of(context).background
        ),
        child: Center(
          child: Text('Home', style: LayoutTheme.of(context).text.title)
        ),
      )
    );
  }
}

Discuss

Loading comments...