design_system 0.4.0: import material_ui

Flutter 3.50 deprecates package:flutter/material.dart for the
material_ui package; its ThemeData is a different type, so apps on
3.50 need the theme builders to return material_ui's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-11-12 09:35:00 +01:00
parent 0ef5461805
commit db1ce8c378
16 changed files with 20 additions and 29 deletions

View File

@ -1,8 +1,8 @@
/// Confirmation for destructive actions. /// Confirmation for destructive actions.
library; library;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:material_ui/material_ui.dart';
/// Asks the user to confirm a destructive action, returning true if they do. /// Asks the user to confirm a destructive action, returning true if they do.
/// ///

View File

@ -2,7 +2,7 @@
library; library;
import 'package:design_system/src/tokens.dart'; import 'package:design_system/src/tokens.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
/// A centred icon, headline and explanation for an empty list. /// A centred icon, headline and explanation for an empty list.
/// ///

View File

@ -8,7 +8,7 @@ library;
import 'package:design_system/src/status_colors.dart'; import 'package:design_system/src/status_colors.dart';
import 'package:design_system/src/tokens.dart'; import 'package:design_system/src/tokens.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
/// How long a neutral confirmation stays up. /// How long a neutral confirmation stays up.
const Duration _toastDuration = Duration(seconds: 3); const Duration _toastDuration = Duration(seconds: 3);

View File

@ -1,7 +1,7 @@
import 'dart:math' as math; import 'dart:math' as math;
import 'package:design_system/src/tokens.dart'; import 'package:design_system/src/tokens.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
/// A grid of square cells that always fits its box, so it never scrolls /// A grid of square cells that always fits its box, so it never scrolls
/// vertically. /// vertically.

View File

@ -2,7 +2,7 @@
library; library;
import 'package:design_system/src/tokens.dart'; import 'package:design_system/src/tokens.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
/// A section title, optionally with a trailing action. /// A section title, optionally with a trailing action.
/// ///
@ -13,12 +13,7 @@ import 'package:flutter/material.dart';
/// caller can adopt it without a visual change. /// caller can adopt it without a visual change.
class SectionHeader extends StatelessWidget { class SectionHeader extends StatelessWidget {
/// Creates a section header. /// Creates a section header.
const SectionHeader( const SectionHeader(this.title, {this.action, this.padding, super.key});
this.title, {
this.action,
this.padding,
super.key,
});
/// The section's title. /// The section's title.
final String title; final String title;

View File

@ -8,7 +8,7 @@
library; library;
import 'package:design_system/src/tokens.dart'; import 'package:design_system/src/tokens.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
/// The four status colors, plus the text color to draw on top of them. /// The four status colors, plus the text color to draw on top of them.
@immutable @immutable

View File

@ -7,7 +7,7 @@ library;
import 'package:design_system/src/status_colors.dart'; import 'package:design_system/src/status_colors.dart';
import 'package:design_system/src/tokens.dart'; import 'package:design_system/src/tokens.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
/// Builds the shared light [ThemeData]. /// Builds the shared light [ThemeData].
ThemeData buildLightTheme() { ThemeData buildLightTheme() {

View File

@ -5,7 +5,7 @@ description: >-
helpers that were each reimplemented in three or more repos. Owns the tokens helpers that were each reimplemented in three or more repos. Owns the tokens
-- consumers import them rather than transcribing the token table by hand. -- consumers import them rather than transcribing the token table by hand.
publish_to: 'none' publish_to: 'none'
version: 0.3.1 version: 0.4.0
environment: environment:
sdk: ^3.12.2 sdk: ^3.12.2
@ -13,6 +13,7 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
material_ui: 1.11.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

View File

@ -1,5 +1,5 @@
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';

View File

@ -1,5 +1,5 @@
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
/// Built at runtime rather than inlined as a literal, so the `EmptyState` /// Built at runtime rather than inlined as a literal, so the `EmptyState`
@ -44,9 +44,7 @@ void main() {
await _pumpEmptyState(tester); await _pumpEmptyState(tester);
final scheme = buildDarkTheme().colorScheme; final scheme = buildDarkTheme().colorScheme;
final message = tester.widget<Text>( final message = tester.widget<Text>(find.text(_message(0)));
find.text(_message(0)),
);
expect(message.style?.color, scheme.onSurfaceVariant); expect(message.style?.color, scheme.onSurfaceVariant);
expect(message.textAlign, TextAlign.center); expect(message.textAlign, TextAlign.center);

View File

@ -1,5 +1,5 @@
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
/// Pumps a screen whose button calls [onPressed] with a context that has a /// Pumps a screen whose button calls [onPressed] with a context that has a

View File

@ -1,5 +1,5 @@
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
final _dot = find.byWidgetPredicate( final _dot = find.byWidgetPredicate(

View File

@ -1,5 +1,5 @@
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
Future<void> _pumpHeader( Future<void> _pumpHeader(

View File

@ -1,5 +1,5 @@
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {

View File

@ -1,5 +1,5 @@
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
@ -100,10 +100,7 @@ void main() {
final focused = input.focusedBorder! as OutlineInputBorder; final focused = input.focusedBorder! as OutlineInputBorder;
expect(focused.borderSide.color, AppPalette.accent); expect(focused.borderSide.color, AppPalette.accent);
expect(focused.borderSide.width, 2.0); expect(focused.borderSide.width, 2.0);
expect( expect(focused.borderRadius, BorderRadius.circular(AppRadius.sm));
focused.borderRadius,
BorderRadius.circular(AppRadius.sm),
);
for (final border in [input.border!, input.enabledBorder!]) { for (final border in [input.border!, input.enabledBorder!]) {
expect( expect(

View File

@ -1,5 +1,5 @@
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {