todos-contra-el-fuego-mobile/lib/widgets/app_intro_page.dart
vjrj 12653b80a4 Fix 78 additional lint issues: rename all files to snake_case and fix 16 style issues
Lint issues fixed (263 total in lib/):
- file_names (57 issues): Renamed all PascalCase files to snake_case
  - All lib files: activeFires -> active_fires, etc.
  - All models: appState -> app_state, fireMapState -> fire_map_state, etc.
  - All redux files: appActions -> app_actions, appReducer -> app_reducer, etc.
- Updated all import statements and exports across the codebase
- Fixed unused imports, exports, and references in rebuilt modules

Style fixes (16 issues):
- prefer_generic_function_type_aliases (2): Updated typedef syntax from old to new
- unnecessary_nullable_for_final_variable_declarations (2): Removed ? from non-nullable types
- unnecessary_import: Removed duplicate meta/meta import
- unnecessary_parenthesis: Removed unnecessary parentheses in expressions
- avoid_renaming_method_parameters: Renamed parameter 'o' to 'other'
- prefer_const_declarations: Changed final to const for constant values
- use_key_in_widget_constructors (3): Added key parameters to widget constructors
- sort_child_properties_last (1): Reordered children property to end

Verification:
- APK builds successfully (146 MB)
- Reduced from 106 lint issues to 49 high-priority issues
- Total file_names issues: 0 (down from 57)
- All imports and exports updated correctly
2026-03-12 09:00:06 +01:00

150 lines
5.3 KiB
Dart

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import '../utils/widget_utils.dart';
class AppIntroItem {
AppIntroItem({required this.icon, required this.title, this.subTitle = ''});
final IconData icon;
final String title;
final String subTitle;
}
typedef OnIntroFinish = void Function(BuildContext context);
typedef ListItems = List<AppIntroItem> Function(BuildContext context);
abstract class AppIntroPage extends StatelessWidget {
const AppIntroPage(
{Key? key, required this.items, required this.onIntroFinish})
: super(key: key);
static const String routeName = '/appintro';
final ListItems items;
final OnIntroFinish onIntroFinish;
@override
Widget build(BuildContext context) {
return Scaffold(
body: DefaultTabController(
length: items(context).length,
child: _AppIntroPageSelector(items: items, onFinish: onIntroFinish),
),
);
}
}
class _AppIntroPageSelector extends StatelessWidget {
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)!;
if (!controller.indexIsChanging)
controller.animateTo(
(controller.index + delta).clamp(0, items(context).length - 1));
}
@override
Widget build(BuildContext context) {
final TabController controller = DefaultTabController.of(context)!;
final ThemeData theme = Theme.of(context);
final Color color = theme.colorScheme.secondary;
final TextStyle titleStyle =
(theme.textTheme.headlineSmall ?? const TextStyle())
.copyWith(color: color);
final TextStyle subTitleStyle =
theme.textTheme.titleMedium ?? const TextStyle();
return SafeArea(
bottom: false,
child: Column(
children: <Widget>[
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
IconButton(
onPressed: () {
onFinish(context);
},
icon:
const Icon(Icons.close, size: 30.0, color: Colors.black38)),
]),
Expanded(child: OrientationBuilder(
builder: (BuildContext context, Orientation orientation) {
return IconTheme(
data: IconThemeData(
size: orientation == Orientation.portrait ? 200.0 : 100.0,
color: color,
),
child: TabBarView(
children: items(context).map((AppIntroItem item) {
return Container(
padding: const EdgeInsets.all(12.0),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Icon(
item.icon,
semanticLabel: item.title,
),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
item.title,
style: titleStyle,
textAlign: TextAlign.center,
),
const SizedBox(height: 20.0),
Text(
item.subTitle,
style: subTitleStyle,
textAlign: TextAlign.center,
)
],
)),
],
),
),
);
}).toList()),
);
})),
Container(
margin: const EdgeInsets.only(top: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: compactWidgets(<Widget?>[
IconButton(
icon: const Icon(Icons.chevron_left),
color: color,
onPressed: () {
_handleArrowButtonPress(context, -1);
},
tooltip: 'Page back'),
TabPageSelector(controller: controller),
IconButton(
icon: const Icon(Icons.chevron_right),
color: color,
onPressed: () {
_handleArrowButtonPress(context, 1);
if (!controller.indexIsChanging &&
controller.index == items(context).length - 1) {
onFinish(context);
}
},
tooltip: 'Page forward'),
]))),
],
),
);
}
}