91 lines
3.5 KiB
Dart
91 lines
3.5 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:birzha/core/adaptix/adaptix.dart';
|
|
import 'package:birzha/models/categories/products/search.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:birzha/components/icon.dart';
|
|
import 'package:birzha/components/tabview.dart';
|
|
import 'package:birzha/constants.dart';
|
|
import 'package:birzha/models/settings/settingsModel.dart';
|
|
import 'package:birzha/screens/productsScreen.dart';
|
|
|
|
class FakeSearchBar extends StatelessWidget {
|
|
const FakeSearchBar({Key? key, this.fromHome = false, required this.route}) : super(key: key);
|
|
|
|
final bool fromHome;
|
|
final String route;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final scaleFactor = min(1.35, MediaQuery.of(context).textScaleFactor);
|
|
return Hero(
|
|
tag: Tabnavigator.currentRoute(context) + '/$route',
|
|
child: Align(
|
|
alignment: Alignment.topCenter,
|
|
child: ConstrainedBox(
|
|
constraints: BoxConstraints.loose(Size(double.infinity, AppConstants.clearAppBarHeight)),
|
|
child: Material(
|
|
color: Colors.transparent,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Navigator.of(context, rootNavigator: false).push(
|
|
CupertinoPageRoute(
|
|
builder: (_) => ProductsScreen(
|
|
route: route,
|
|
category: ProductsSearch(),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(horizontal: AppConstants.horizontalPadding(context)),
|
|
height: AppConstants.clearAppBarHeight,
|
|
child: Row(
|
|
children: [
|
|
if (!fromHome) ...[
|
|
AppIconButton(
|
|
icon: Icon(
|
|
CupertinoIcons.back,
|
|
color: Theme.of(context).accentColor,
|
|
),
|
|
onTap: () {
|
|
Tabnavigator.backDispatcher(context);
|
|
},
|
|
size: AppConstants.appBarIconSize),
|
|
SizedBox(
|
|
width: 12.adaptedPx(),
|
|
)
|
|
],
|
|
Expanded(
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(vertical: AppConstants.clearAppBarHeight * 0.18),
|
|
child: Container(
|
|
decoration:
|
|
BoxDecoration(color: Theme.of(context).dividerColor.withOpacity(0.06), borderRadius: BorderRadius.circular(5.adaptedPx())),
|
|
alignment: Alignment.centerLeft,
|
|
padding: EdgeInsets.symmetric(horizontal: 15.adaptedPx()),
|
|
child: Row(
|
|
children: [
|
|
Expanded(child: Text('search'.translation, textScaleFactor: scaleFactor, style: TextStyle(fontWeight: FontWeight.w300))),
|
|
Icon(
|
|
CupertinoIcons.search,
|
|
color: Theme.of(context).accentColor,
|
|
size: AppConstants.appBarIconSize * 0.8,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|