refactor: linting de widgets de layout y utilidades

Ajustes de estilo/linting en los helpers centered* de layout,
appIntroPage, roundedButton, secretLoader y utils (refactor pendiente).
This commit is contained in:
vjrj 2026-07-12 23:26:43 +02:00
parent 9b0fe987f8
commit 51fe8c6431
15 changed files with 141 additions and 126 deletions

View file

@ -11,7 +11,7 @@ class AppIntroItem {
final String title;
final String subTitle;
AppIntroItem({this.icon, this.title, this.subTitle = ''});
AppIntroItem({required this.icon, required this.title, this.subTitle = ''});
// 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec vitae eros. Nunc sit amet neque. Ut id dui. Integer viverra feugiat sem. Morbi aliquam turpis rhoncus sapien volutpat condimentum.'});
}
@ -23,83 +23,86 @@ abstract class AppIntroPage extends StatelessWidget {
final ListItems items;
final OnIntroFinish onIntroFinish;
const AppIntroPage({Key key, this.items, this.onIntroFinish})
const AppIntroPage(
{Key? key, required this.items, required this.onIntroFinish})
: super(key: key);
@override
Widget build(BuildContext context) {
return new Scaffold(
// appBar: new AppBar(),
body: new DefaultTabController(
return Scaffold(
// appBar: AppBar(),
body: DefaultTabController(
length: items(context).length,
child: new _AppIntroPageSelector(items: items, onFinish: onIntroFinish),
child: _AppIntroPageSelector(items: items, onFinish: onIntroFinish),
),
);
}
}
class _AppIntroPageSelector extends StatelessWidget {
const _AppIntroPageSelector({this.items, this.onFinish});
const _AppIntroPageSelector({required this.items, required this.onFinish});
final ListItems items;
final OnIntroFinish onFinish;
void _handleArrowButtonPress(BuildContext context, int delta) {
final TabController controller = DefaultTabController.of(context);
final TabController controller = DefaultTabController.of(context)!;
if (!controller.indexIsChanging)
controller
.animateTo((controller.index + delta).clamp(0, items(context).length - 1));
controller.animateTo(
(controller.index + delta).clamp(0, items(context).length - 1));
}
@override
Widget build(BuildContext context) {
final TabController controller = DefaultTabController.of(context);
final TabController controller = DefaultTabController.of(context)!;
final ThemeData theme = Theme.of(context);
final Color color = theme.accentColor;
final Color color = theme.colorScheme.secondary;
final TextStyle titleStyle =
theme.textTheme.headline.copyWith(color: color);
(theme.textTheme.headlineSmall ?? const TextStyle())
.copyWith(color: color);
final TextStyle subTitleStyle =
theme.textTheme.subhead; //.copyWith(color: color);
theme.textTheme.titleMedium ?? const TextStyle();
// final TextStyle descriptionStyle = theme.textTheme.subhead;
return new SafeArea(
return SafeArea(
top: true,
bottom: false,
child: new Column(
child: Column(
children: <Widget>[
new Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
new IconButton(
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
IconButton(
onPressed: () {
onFinish(context);
},
icon: new Icon(Icons.close, size: 30.0, color: Colors.black38)),
icon:
const Icon(Icons.close, size: 30.0, color: Colors.black38)),
]),
new Expanded(
child: new OrientationBuilder(builder: (context, orientation) {
return new IconTheme(
data: new IconThemeData(
Expanded(child: OrientationBuilder(builder: (context, orientation) {
return IconTheme(
data: IconThemeData(
size: orientation == Orientation.portrait ? 200.0 : 100.0,
color: color,
),
child: new TabBarView(
child: TabBarView(
children: items(context).map((AppIntroItem item) {
return new Container(
return Container(
padding: const EdgeInsets.all(12.0),
child: new Center(
child: new CenteredSpaceEvenlyColumn(children: <Widget>[
child: Center(
child: CenteredSpaceEvenlyColumn(children: <Widget>[
Icon(
item.icon,
semanticLabel: item.title,
),
new Padding(
padding: new EdgeInsets.only(left: 16.0, right: 16.0),
child: new CenteredColumn(children: <Widget>[
new Text(
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: CenteredColumn(children: <Widget>[
Text(
item.title,
style: titleStyle,
textAlign: TextAlign.center,
),
new SizedBox(height: 20.0),
new Text(
const SizedBox(height: 20.0),
Text(
item.subTitle,
style: subTitleStyle,
textAlign: TextAlign.center,
@ -111,19 +114,19 @@ class _AppIntroPageSelector extends StatelessWidget {
}).toList()),
);
})),
new Container(
Container(
margin: const EdgeInsets.only(top: 16.0),
child: new Row(
child: Row(
children: listWithoutNulls(<Widget>[
new IconButton(
IconButton(
icon: const Icon(Icons.chevron_left),
color: color,
onPressed: () {
_handleArrowButtonPress(context, -1);
},
tooltip: 'Page back'),
new TabPageSelector(controller: controller),
new IconButton(
TabPageSelector(controller: controller),
IconButton(
icon: const Icon(Icons.chevron_right),
color: color,
onPressed: () {