-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Waiting on simc/auto_size_text#35 to be implemented in auto_size_text
- Loading branch information
Showing
3 changed files
with
75 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import 'package:api_client/models/week_model.dart'; | ||
import 'package:auto_size_text/auto_size_text.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Widget for rendering week and year for a week plan. | ||
class WeekYearRowWidget extends StatelessWidget { | ||
/// Renders week and year for [weekplan]. | ||
/// Uses [autoSizeGroup] to make sure the font size | ||
/// is consistent across weekplan cards. | ||
const WeekYearRowWidget({ | ||
Key key, | ||
@required this.weekplan, | ||
@required this.autoSizeGroup, | ||
}) : super(key: key); | ||
|
||
/// The weekplan to show week and year for. | ||
final WeekModel weekplan; | ||
|
||
/// The weekplan to show week and year for. | ||
final AutoSizeGroup autoSizeGroup; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
child: weekplan.weekNumber == null | ||
? null | ||
: Expanded( | ||
child: Row( | ||
children: <Widget>[ | ||
Expanded( | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 4.0), | ||
child: AutoSizeText( | ||
'Uge: ${weekplan.weekNumber}', | ||
key: const Key('weekyear_week'), | ||
style: const TextStyle(fontSize: 18), | ||
maxLines: 1, | ||
minFontSize: 8, | ||
textAlign: TextAlign.center, | ||
overflow: TextOverflow.ellipsis, | ||
group: autoSizeGroup, | ||
), | ||
), | ||
), | ||
Expanded( | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 4.0), | ||
child: AutoSizeText( | ||
'År: ${weekplan.weekYear}', | ||
key: const Key('weekyear_year'), | ||
style: const TextStyle(fontSize: 18), | ||
maxLines: 1, | ||
minFontSize: 8, | ||
textAlign: TextAlign.center, | ||
overflow: TextOverflow.ellipsis, | ||
group: autoSizeGroup, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters