⌥ + middle mouse click = Home button
⌥ + backspace = Back button
⌥ + S = App switcher
⌥ + middle mouse click = Home button
⌥ + backspace = Back button
⌥ + S = App switcher
Sometimes we need to test that a widget is doing a particular thing based on a provided parameter, or something similar. We can do this by using tester.widget and TypeMatcher's having() function.
Let's say we have a custom app bar that, using package:badges, should show a badge on the leading widget (which shows if there is a drawer) if the int badgeCount passed to it is greater than zero. Simply testing for the existence of the Badge widget isn't correct, because Badge is always being built - we need to test if the badge's showBadge property is false. We'd write our test like so:
import 'package:badges/badges.dart';
import 'package:flutter/material.dart' hide Badge;
import 'package:flutter_test/flutter_test.dart';
import 'package:my_package/src/widgets/custom_app_bar.dart';| Mode | Mouse hover | Hex value |
|---|---|---|
| Light | ❌ | #C2C2C2 |
| Light | ✅ | #7D7D7D |
| Dark | ❌ | #6E6A73 |
| Dark | ✅ | #97959A |
These are my personal setup tasks when setting up a new Flutter development environment on macOS
brew install git| // | |
| // SystemAccentColorProvider.swift | |
| // macos_ui | |
| // | |
| // Created by Reuben Turner on 7/9/22. | |
| // | |
| import FlutterMacOS | |
| import AppKit |
act is a tool for running GitHub actions locally. Commands can get very unwieldy so I've created an alias in my .zshrc file that makes things easier:
alias actm="act -s GITHUB_TOKEN=YOUR_TOKEN_HERE --container-architecture linux/amd64 -r"
Breakdown:
GITHUB_TOKEN that is included in every repo, it is added here. Replace YOUR_TOKEN_HERE with a personal access token from GitHub.--container-architecture linux/amd64 flag is required-r flag allows for containers from jobs to be reused, making for faster jobs.My use of the classic (or "vintage") BLoC pattern (not to be confused with Felix Angelov's great bloc library) has evolved over the years. I do no use dedicated sinks for input and dedicated streams for output. Rather, I directly use rxdart's excellent BehaviorSubject directly. BehaviorSubject implements ValueStream, which itself implements Stream, so I found that I could reduce boilerplate a lot by doing this. Values can be directly added to, and read from, a BehaviorSubject. I then use provider to pass my services (I don't really think of them as "bloc"s any more) through my app. This gist provides a real example of how I currently use this pattern.
prefs_service.dart is where the service is defined.main.dart shows how to initialize the service.app.dart shows how I use MultiProvider to pass down my service. I always use MultiProvider rather than one single provider to allow for more services. I listen to the BehaviorSubject in my service to set the ThemeMode of my `Ma| /// Example for how to dynamically change the appearance of an AppBar based on BottomNavigationBar page index. | |
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( |