Files
hash-wallet/lib/src/widgets/tab_view_wrapper_widget.dart
T
SerhiiandGitHub ef84db5874 Cw 973 in app gift card redemption flow plus UI (#2285)
* refactor: cleanup cake_pay folder

* refactor: add My Cards tab on the main screen

* ui: add user card item

* refactor: cakePay purchase flow

* feat: add user card info

* refactor: auth flow

* refactor: theme data

* revert

* Update qr_widget.dart

* fix: update with new themes

* minor fixes

* feat: put redemption flow under a feature flag

* feat: implement simulated purchasing flow in debug mode

* feat: support LTC and MWEB payments

* Update savings_page.dart

* fix: UI fixes

* add Cake Pay transaction sent bottom sheet

* localization

* Update cake_pay_buy_card_page.dart

* addressing review comments

* fix marge conflicts
2025-07-11 23:56:35 +03:00

80 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
class TabViewWrapper extends StatefulWidget {
const TabViewWrapper({
super.key,
required this.tabs,
required this.views,
this.tabBarPadding = const EdgeInsets.only(right: 24),
this.labelStyle,
this.unselectedLabelStyle,
this.indicatorColor,
}) : assert(tabs.length == views.length, 'Tabs and views must be of equal length.');
final List<Tab> tabs;
final List<Widget> views;
final EdgeInsets tabBarPadding;
final TextStyle? labelStyle;
final TextStyle? unselectedLabelStyle;
final Color? indicatorColor;
@override
State<TabViewWrapper> createState() => _TabViewWrapperState();
}
class _TabViewWrapperState extends State<TabViewWrapper> with SingleTickerProviderStateMixin {
late final TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: widget.tabs.length, vsync: this);
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final textStyle = TextStyle(
fontSize: 18,
fontFamily: 'Lato',
fontWeight: FontWeight.w600,
color: Theme.of(context).colorScheme.onSurface);
return Column(
children: [
Align(
alignment: Alignment.centerLeft,
child: TabBar(
controller: _tabController,
isScrollable: true,
splashFactory: NoSplash.splashFactory,
indicatorSize: TabBarIndicatorSize.label,
labelStyle: widget.labelStyle ?? textStyle,
unselectedLabelStyle: widget.unselectedLabelStyle ??
textStyle.copyWith(color: textStyle.color?.withAlpha(150)),
labelColor: widget.labelStyle?.color ?? textStyle.color,
indicatorColor: widget.indicatorColor,
indicatorPadding: EdgeInsets.zero,
labelPadding: widget.tabBarPadding,
tabAlignment: TabAlignment.start,
dividerColor: Colors.transparent,
padding: EdgeInsets.zero,
tabs: widget.tabs,
),
),
Expanded(
child: TabBarView(
controller: _tabController,
children: widget.views,
),
),
],
);
}
}