Skip to content

Commit

Permalink
fix use of fixed width fonts in the console (#2980)
Browse files Browse the repository at this point in the history
* fix use of fixed width fonts in the console

* formatting
  • Loading branch information
devoncarew committed Jun 4, 2024
1 parent b3926a5 commit dc44acd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
File renamed without changes.
13 changes: 9 additions & 4 deletions pkgs/dartpad_ui/lib/console.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

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

import 'theme.dart';
import 'widgets.dart';
Expand Down Expand Up @@ -50,8 +51,11 @@ class _ConsoleWidgetState extends State<ConsoleWidget> {
color: theme.scaffoldBackgroundColor,
border: widget.showDivider
? Border(
top: Divider.createBorderSide(context,
width: 8.0, color: theme.colorScheme.surface))
top: Divider.createBorderSide(
context,
width: 8.0,
color: theme.colorScheme.surface,
))
: null,
),
padding: const EdgeInsets.all(denseSpacing),
Expand All @@ -65,8 +69,9 @@ class _ConsoleWidgetState extends State<ConsoleWidget> {
textInputAction: TextInputAction.newline,
expands: true,
decoration: null,
style:
theme.textTheme.bodyMedium!.copyWith(fontFamily: 'RobotoMono'),
style: GoogleFonts.robotoMono(
fontSize: theme.textTheme.bodyMedium?.fontSize,
),
readOnly: true,
),
Padding(
Expand Down
5 changes: 5 additions & 0 deletions pkgs/dartpad_ui/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_web_plugins/url_strategy.dart' show usePathUrlStrategy;
import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:provider/provider.dart';
import 'package:split_view/split_view.dart';
Expand All @@ -34,6 +35,10 @@ const smallScreenWidth = 720;

void main() async {
usePathUrlStrategy();

// Make sure that the google fonts don't load from http.
GoogleFonts.config.allowRuntimeFetching = false;

runApp(const DartPadApp());
}

Expand Down
9 changes: 3 additions & 6 deletions pkgs/dartpad_ui/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dependencies:
sdk: flutter
fluttering_phrases: ^1.0.0
go_router: ^14.1.4
google_fonts: ^6.2.0
http: ^1.2.1
json_annotation: ^4.9.0
pointer_interceptor: ^0.10.0
Expand All @@ -37,12 +38,8 @@ flutter:
- assets/flame_logo_192.png
- assets/flutter_logo_192.png
- assets/gemini_sparkle_192.png
fonts:
- family: RobotoMono
fonts:
- asset: assets/fonts/RobotoMono-Regular.ttf
- asset: assets/fonts/RobotoMono-Bold.ttf
weight: 700
- assets/RobotoMono-Bold.ttf
- assets/RobotoMono-Regular.ttf

dependency_overrides:
dartpad_shared:
Expand Down

0 comments on commit dc44acd

Please sign in to comment.