Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
rearrange code to be more intuitive
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelGarus committed Mar 6, 2020
1 parent 61547bf commit 396d006
Showing 1 changed file with 35 additions and 25 deletions.
60 changes: 35 additions & 25 deletions lib/translation_row.dart
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ import 'id_with_highlighted_parts.dart';
import 'translation_field.dart';
import 'translation_grid.dart';

const _animationDuration = Duration(seconds: 1);

class TranslationRow extends StatefulWidget {
const TranslationRow({
Key key,
@@ -43,33 +45,41 @@ class _TranslationRowState extends State<TranslationRow> {
}

final locales = snapshot.data;
return Material(
color: Theme.of(context).scaffoldBackgroundColor,
elevation: _isSelected ? 4 : 0,
child: GridRow(
proportions: widget.proportions,
leading: _buildIssueDot(),
trailing: Center(
child: IconButton(
icon: Icon(Icons.delete_outline),
tooltip: 'Delete resource',
onPressed: () {
// project.
Scaffold.of(context).showSnackBar(SnackBar(
content: Text('Resource ${widget.id} deleted.'),
));
},
return AnimatedPadding(
duration: _animationDuration,
padding: EdgeInsets.symmetric(vertical: _isSelected ? 16 : 0),
child: FocusAttachment(
child: Material(
animationDuration: _animationDuration,
color: Theme.of(context).scaffoldBackgroundColor,
elevation: _isSelected ? 4 : 0,
child: GridRow(
proportions: widget.proportions,
leading: _buildIssueDot(),
cells: [
IdWithHighlightedParts(
id: widget.id,
partsToHighlight: widget.partsToHighlight.isNotEmpty
? widget.partsToHighlight
: null,
),
for (final locale in locales)
TranslationField(widget.id, locale),
],
trailing: Center(
child: IconButton(
icon: Icon(Icons.delete_outline),
tooltip: 'Delete resource',
onPressed: () {
// project.
Scaffold.of(context).showSnackBar(SnackBar(
content: Text('Resource ${widget.id} deleted.'),
));
},
),
),
),
),
cells: [
IdWithHighlightedParts(
id: widget.id,
partsToHighlight: widget.partsToHighlight.isNotEmpty
? widget.partsToHighlight
: null,
),
for (final locale in locales) TranslationField(widget.id, locale),
],
),
);
},

0 comments on commit 396d006

Please sign in to comment.