bottom bar release

null-safety-migration
suvaissov 2021-08-05 11:23:41 +06:00
parent cc2493ba2e
commit 55e276b189
7 changed files with 183 additions and 23 deletions

View File

@ -0,0 +1,6 @@
<svg width="102" height="102" viewBox="0 0 102 102" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M70.2215 80.3767C64.2917 80.3767 59.4022 85.1588 59.4022 91.1883C59.4022 97.1139 64.1876 102 70.2215 102C76.1513 102 81.0408 97.2179 81.0408 91.1883C80.9368 85.2627 76.1513 80.3767 70.2215 80.3767Z" fill="black"/>
<path d="M22.887 28.7099L55.7749 28.1215C58.7211 45.7862 78.7351 50.8622 89.7072 44.4664L85.8263 67.3822C84.6819 72.684 80.0005 76.5305 74.5909 76.5305H31.3136C25.6959 76.5305 20.9104 72.3722 20.0782 66.8624L13.6282 22.9922C13.5241 22.4724 13.108 22.0566 12.5879 22.0566H4.16127C1.87257 22.0566 0 20.1854 0 17.8983C0 15.6112 1.87257 13.74 4.16127 13.74H12.5879C17.2693 13.74 21.2225 17.1706 21.8467 21.7447L22.887 28.7099Z" fill="black"/>
<path d="M43.6934 90.6685C43.4853 84.9508 38.6999 80.3767 32.9781 80.3767C26.9443 80.6886 22.3669 85.6786 22.5749 91.6041C22.783 97.3218 27.4644 101.896 33.1862 101.896H33.3943C39.3241 101.584 44.0055 96.5941 43.6934 90.6685Z" fill="black"/>
<path d="M79.9542 0C67.7977 0 57.9084 9.88222 57.9084 22.0301C57.9084 34.178 67.7977 44.0602 79.9542 44.0602C92.1108 44.0602 102 34.178 102 22.0301C102 9.88222 92.1108 0 79.9542 0ZM89.5993 23.8658H81.7912V31.6683C81.7912 32.6818 80.9684 33.504 79.9542 33.504C78.94 33.504 78.1172 32.6818 78.1172 31.6683V23.8658H70.3092C69.2949 23.8658 68.4721 23.0436 68.4721 22.0301C68.4721 21.0166 69.2949 20.1944 70.3092 20.1944H78.1172V12.3919C78.1172 11.3784 78.94 10.5562 79.9542 10.5562C80.9684 10.5562 81.7912 11.3784 81.7912 12.3919V20.1944H89.5993C90.6135 20.1944 91.4363 21.0166 91.4363 22.0301C91.4363 23.0436 90.6135 23.8658 89.5993 23.8658Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,10 @@
<svg width="104" height="104" viewBox="0 0 104 104" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0)">
<path d="M82.7657 12.3219H80.6171C79.7742 9.07844 76.8564 6.67001 73.3471 6.67001H63.1188C60.9593 2.719 56.812 0 52.0005 0C47.1897 0 43.0411 2.72263 40.8816 6.67001H30.6533C27.1416 6.67001 24.2256 9.07784 23.3815 12.3219H21.2347C17.0753 12.3219 13.6995 15.6995 13.6995 19.8566V96.4653C13.6995 100.627 17.0753 104.001 21.2347 104.001H82.7657C86.9234 104.001 90.301 100.627 90.301 96.4653V19.8566C90.3004 15.6898 86.93 12.3219 82.7657 12.3219ZM52.0005 7.29538C54.9914 7.29538 57.4162 9.72194 57.4162 12.7153C57.4162 15.7062 54.9914 18.1309 52.0005 18.1309C49.009 18.1309 46.5825 15.7025 46.5825 12.7153C46.5825 9.72798 49.0084 7.29538 52.0005 7.29538ZM30.1029 79.5078C28.0189 79.5078 26.3356 77.8227 26.3356 75.7399C26.3356 73.6578 28.0189 71.9732 30.1029 71.9732C32.1911 71.9732 33.8702 73.6578 33.8702 75.7399C33.8708 77.8227 32.1838 79.5078 30.1029 79.5078ZM30.1029 60.67C28.0189 60.67 26.3356 58.9848 26.3356 56.9027C26.3356 54.8199 28.0189 53.1353 30.1029 53.1353C32.1911 53.1353 33.8702 54.8199 33.8702 56.9027C33.8708 58.9848 32.1838 60.67 30.1029 60.67ZM30.1029 41.8321C28.0189 41.8321 26.3356 40.1452 26.3356 38.0648C26.3356 35.9827 28.0189 34.2975 30.1029 34.2975C32.1911 34.2975 33.8702 35.9827 33.8702 38.0648C33.8708 40.1452 32.1838 41.8321 30.1029 41.8321ZM75.5725 79.5078H42.487C40.3989 79.5078 38.7197 77.8227 38.7197 75.7399C38.7197 73.6578 40.3995 71.9732 42.487 71.9732H75.5725C77.6588 71.9732 79.3398 73.6578 79.3398 75.7399C79.3404 77.8227 77.6588 79.5078 75.5725 79.5078ZM75.5725 60.67H42.487C40.3989 60.67 38.7197 58.9848 38.7197 56.9027C38.7197 54.8199 40.3995 53.1353 42.487 53.1353H75.5725C77.6588 53.1353 79.3398 54.8199 79.3398 56.9027C79.3404 58.9848 77.6588 60.67 75.5725 60.67ZM75.5725 41.8321H42.487C40.3989 41.8321 38.7197 40.1452 38.7197 38.0648C38.7197 35.9827 40.3995 34.2975 42.487 34.2975H75.5725C77.6588 34.2975 79.3398 35.9827 79.3398 38.0648C79.3404 40.1452 77.6588 41.8321 75.5725 41.8321Z" fill="black"/>
</g>
<defs>
<clipPath id="clip0">
<rect width="104" height="104" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,13 @@
<svg width="100" height="103" viewBox="0 0 100 103" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M68.8446 81.1648C63.0311 81.1648 58.2374 85.9937 58.2374 92.0824C58.2374 98.0661 62.9291 103 68.8446 103C74.6582 103 79.4518 98.1711 79.4518 92.0824C79.3498 86.0987 74.6582 81.1648 68.8446 81.1648Z" fill="black"/>
<path d="M22.4382 28.9914L54.6813 28.3973C57.5697 46.2351 77.1912 51.361 87.9482 44.9024L84.1434 68.0429C83.0215 73.3967 78.4319 77.2808 73.1283 77.2808H30.6996C25.192 77.2808 20.5004 73.0818 19.6845 67.518L13.361 23.2177C13.259 22.6928 12.851 22.2729 12.341 22.2729H4.07968C1.83586 22.2729 0 20.3833 0 18.0738C0 15.7643 1.83586 13.8748 4.07968 13.8748H12.341C16.9307 13.8748 20.8064 17.339 21.4183 21.958L22.4382 28.9914Z" fill="black"/>
<path d="M42.8366 91.5575C42.6326 85.7838 37.941 81.1648 32.3314 81.1648C26.4159 81.4797 21.9283 86.5186 22.1322 92.5023C22.3362 98.276 26.9259 102.895 32.5354 102.895H32.7394C38.553 102.58 43.1426 97.5412 42.8366 91.5575Z" fill="black"/>
<g clip-path="url(#clip0)">
<path d="M56.7729 22.2461C56.7729 34.5115 66.4698 44.4922 78.3864 44.4922C90.3031 44.4922 100 34.5115 100 22.2461C100 9.98072 90.3031 1.56703e-05 78.3864 1.55241e-05C66.4698 1.53778e-05 56.7729 9.98072 56.7729 22.2461ZM79.9826 12.4623L86.7682 18.3931C87.342 18.8936 87.6381 19.6099 87.6381 20.3274C87.6381 20.9069 87.4447 21.492 87.0513 21.9703C86.1727 23.0381 84.6155 23.1693 83.5769 22.2628L80.8525 19.8802L80.8525 30.0979C80.8525 31.4994 79.7492 32.635 78.3875 32.635C77.0259 32.635 75.9225 31.4994 75.9225 30.0979L75.9225 19.8802L73.1981 22.2628C72.1596 23.1693 70.6045 23.0381 69.7216 21.9703C68.8408 20.9024 68.9683 19.3007 70.0069 18.3931L76.7924 12.4623C77.711 11.657 79.0619 11.657 79.9826 12.4623Z" fill="black"/>
</g>
<defs>
<clipPath id="clip0">
<rect width="44.4922" height="43.2271" fill="white" transform="translate(56.7729 44.4922) rotate(-90)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -7,6 +7,7 @@ import 'package:satu/shared/app_colors.dart';
import 'package:satu/views/work/tabs/buy_view.dart';
import 'package:satu/views/work/tabs/journal_view.dart';
import 'package:satu/views/work/tabs/sell_view.dart';
import 'package:satu/widgets/bar/bottom_bar.dart';
class WorkView extends StatefulWidget {
final String? text;
@ -44,29 +45,30 @@ class _WorkViewState extends State<WorkView> {
Widget build(BuildContext context) {
return Scaffold(
body: _widgetOptions.elementAt(_selectedIndex),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(MdiIcons.cartArrowUp),
label: 'Продажа',
),
BottomNavigationBarItem(
icon: Icon(MdiIcons.cartArrowDown),
label: 'Покупка',
),
BottomNavigationBarItem(
icon: Icon(MdiIcons.cashRegister),
label: 'Журнал',
),
],
currentIndex: _selectedIndex,
unselectedItemColor: Colors.black54,
selectedItemColor: primaryColor,
selectedLabelStyle: const TextStyle( fontWeight: FontWeight.w600 ),
backgroundColor: whiteColor,
elevation: 8.0,
onTap: _onItemTapped,
),
bottomNavigationBar: BottomBar(selectedIndex: _selectedIndex, onTap: _onItemTapped,),
// bottomNavigationBar: BottomNavigationBar(
// items: const <BottomNavigationBarItem>[
// BottomNavigationBarItem(
// icon: Icon(MdiIcons.cartArrowUp),
// label: 'Продажа',
// ),
// BottomNavigationBarItem(
// icon: Icon(MdiIcons.cartArrowDown),
// label: 'Покупка',
// ),
// BottomNavigationBarItem(
// icon: Icon(MdiIcons.cashRegister),
// label: 'Журнал',
// ),
// ],
// currentIndex: _selectedIndex,
// unselectedItemColor: Colors.black54,
// selectedItemColor: primaryColor,
// selectedLabelStyle: const TextStyle( fontWeight: FontWeight.w600 ),
// backgroundColor: whiteColor,
// elevation: 8.0,
// onTap: _onItemTapped,
// ),
);
}
}

View File

@ -0,0 +1,92 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:satu/shared/app_colors.dart';
class BottomBar extends StatelessWidget {
const BottomBar({required this.selectedIndex, required this.onTap, Key? key})
: super(key: key);
final int selectedIndex;
final void Function(int index) onTap;
@override
Widget build(BuildContext context) {
return Material(
elevation: 8.0,
child: SafeArea(
child: SizedBox(
height: 60.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
BottomButton(
active: selectedIndex == 0,
onTap: () => onTap(0),
svgFile: 'sell',
),
BottomButton(
active: selectedIndex == 1,
onTap: () => onTap(1),
svgFile: 'buy',
),
BottomButton(
active: selectedIndex == 2,
onTap: () => onTap(2),
svgFile: 'journal',
),
],
),
),
),
);
}
}
class BottomButton extends StatelessWidget {
const BottomButton({
required this.svgFile,
required this.onTap,
required this.active,
Key? key,
}) : super(key: key);
final String svgFile;
final void Function() onTap;
final bool active;
@override
Widget build(BuildContext context) {
return Stack(
children: [
Positioned.fill(
child: Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(
width: 3.0,
color: active ? primaryColor : Colors.transparent),
)),
),
),
ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SvgPicture.asset(
'assets/images/svg/$svgFile.svg',
height: 30,
width: 30,
color: active ? primaryColor : placeholderColor,
),
),
),
),
),
],
);
}
}

View File

@ -160,6 +160,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0+2"
flutter_svg:
dependency: "direct main"
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.22.0"
flutter_test:
dependency: "direct dev"
description: flutter
@ -282,6 +289,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
path_provider:
dependency: "direct main"
description:
@ -338,6 +359,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
platform:
dependency: transitive
description:
@ -623,6 +651,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.2"
sdks:
dart: ">=2.13.0 <3.0.0"
flutter: ">=2.0.0"

View File

@ -56,6 +56,7 @@ dependencies:
charset_converter: ^2.0.0
ai_barcode: ^3.0.1
permission_handler: ^8.1.4+2
flutter_svg: ^0.22.0
dev_dependencies:
flutter_test:
sdk: flutter
@ -77,6 +78,7 @@ flutter:
assets:
- assets/images/
- assets/images/drawer/
- assets/images/svg/
- assets/lang/en.json
- assets/lang/ru.json
- assets/google_fonts/