Skip to content

Commit

Permalink
avatar colors tested
Browse files Browse the repository at this point in the history
  • Loading branch information
Daviiddoo committed Jul 22, 2024
1 parent 6f21b1c commit 8f08292
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
13 changes: 9 additions & 4 deletions forui/example/lib/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ class _ExampleState extends State<Example> {
const SizedBox(height: 100),
FProgress(value: 0.9),
const SizedBox(height: 10),
FAlert(
title: const Text('Heads Up! Forui is coming to flutter!'),
subtitle: const Text('You can add components dfijsoi djfosfj to your app using the cli.'),
)
const FAvatar(
child: Text('DC'),
//backgroundImage: NetworkImage('https://picsum.photos/250?image=9'),
),
const SizedBox(height: 20),
const CircleAvatar(
backgroundImage: NetworkImage('https://picsum.photos/250?image=9'),
child: Text('DC'),
),
],
);
}
1 change: 0 additions & 1 deletion forui/lib/src/theme/theme_data.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:forui/src/widgets/avatar.dart';

import 'package:meta/meta.dart';

Expand Down
15 changes: 7 additions & 8 deletions forui/lib/src/widgets/avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,9 @@ class FAvatar extends StatelessWidget {
child: child == null
? null
: Center(
// Need to disable text scaling here so that the text doesn't
// escape the avatar when the textScaleFactor is large.
child: MediaQuery.withNoTextScaling(
child: DefaultTextStyle(
style: style.text,
child: child!,
),
child: DefaultTextStyle(
style: style.text,
child: child!,
),
),
);
Expand Down Expand Up @@ -113,7 +109,10 @@ final class FAvatarStyle with Diagnosticable {
FAvatarStyle.inherit({required FColorScheme colorScheme, required FTypography typography})
: backgroundColor = colorScheme.muted,
constraints = const BoxConstraints(minHeight: 40.0, minWidth: 40.0, maxHeight: 40.0, maxWidth: 40.0),
text = typography.base.copyWith(color: colorScheme.mutedForeground);
text = typography.base.copyWith(
color: colorScheme.mutedForeground,
height: 0,
);

/// Returns a copy of this [FAvatarStyle] with the given properties replaced.
///
Expand Down
1 change: 1 addition & 0 deletions forui/lib/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ library forui.widgets;
import 'package:forui/forui.dart';

export 'src/widgets/alert/alert.dart' hide Variant;
export 'src/widgets/avatar.dart';
export 'src/widgets/badge/badge.dart' hide Variant;
export 'src/widgets/bottom_navigation_bar/bottom_navigation_bar.dart';
export 'src/widgets/button/button.dart' hide Variant;
Expand Down

0 comments on commit 8f08292

Please sign in to comment.