Biex tapplika dell kaxxa għal a TabBar
in Flutter, tista 'wrapha f'a Container
u tuża l- BoxDecoration
proprjetà. Hawn eżempju:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
title: Text('TabBar with Shadow'),
bottom: TabBar(
tabs: [
Tab(text: 'Tab 1'),
Tab(text: 'Tab 2'),
Tab(text: 'Tab 3'),
],
),
),
body: TabBarView(
children: [
Container(color: Colors.red),
Container(color: Colors.green),
Container(color: Colors.blue),
],
),
),
);
}
}
Jekk trid iżżid effett ta 'dell mal- TabBar
, tista' tgeżwer TabBar
f'a Container
u tapplika l- BoxDecoration
:
Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), // changes position of shadow
),
],
),
child: TabBar(
tabs: [
Tab(text: 'Tab 1'),
Tab(text: 'Tab 2'),
Tab(text: 'Tab 3'),
],
),
),
F'dan l-eżempju, BoxShadow
huwa użat biex jinħoloq effett dell għall- TabBar
. Tista 'tippersonalizza l-kulur, ir-raġġ mifrux, ir-raġġ taċ-ċajpra, u l-offset biex tikseb id-dehra mixtieqa tad-dell.
Ftakar li taġġusta l-proprjetajiet tad-dell biex taqbel mal-ħtiġijiet tad-disinn tiegħek.
Jekk jogħġbok innota li l-applikazzjoni ta 'dell tista' ma taħdimx jekk AppBar
diġà qed tuża l-elevazzjoni. F'każijiet bħal dawn, jista 'jkollok bżonn tuża widgets tad-dwana jew taġġusta d-disinn biex takkomoda ż-żewġ effetti.