From fa074209aa2422ed20890b595e8155748392c7b4 Mon Sep 17 00:00:00 2001 From: Georgee Date: Thu, 16 May 2024 20:52:27 +0300 Subject: [PATCH 1/2] fixed text theme --- .history/example/lib/main_20240516205112.dart | 163 ++++++++++++++++++ .history/example/lib/main_20240516205202.dart | 163 ++++++++++++++++++ example/lib/main.dart | 6 +- 3 files changed, 329 insertions(+), 3 deletions(-) create mode 100644 .history/example/lib/main_20240516205112.dart create mode 100644 .history/example/lib/main_20240516205202.dart diff --git a/.history/example/lib/main_20240516205112.dart b/.history/example/lib/main_20240516205112.dart new file mode 100644 index 0000000..7cc7a72 --- /dev/null +++ b/.history/example/lib/main_20240516205112.dart @@ -0,0 +1,163 @@ +import 'package:flutter/material.dart'; +import 'package:numberpicker/numberpicker.dart'; + +void main() { + runApp(new ExampleApp()); +} + +class ExampleApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'NumberPicker Example', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: MyHomePage(), + ); + } +} + +class MyHomePage extends StatefulWidget { + @override + _MyHomePageState createState() => new _MyHomePageState(); +} + +class _MyHomePageState extends State { + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 2, + child: Scaffold( + appBar: AppBar( + bottom: TabBar( + tabs: [ + Tab(text: 'Integer'), + Tab(text: 'Decimal'), + ], + ), + title: Text('Numberpicker example'), + ), + body: TabBarView( + children: [ + _IntegerExample(), + _DecimalExample(), + ], + ), + ), + ); + } +} + +class _IntegerExample extends StatefulWidget { + @override + __IntegerExampleState createState() => __IntegerExampleState(); +} + +class __IntegerExampleState extends State<_IntegerExample> { + int _currentIntValue = 10; + int _currentHorizontalIntValue = 10; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SizedBox(height: 16), + Text('Default', style: Theme.of(context).textTheme.headline6), + NumberPicker( + value: _currentIntValue, + minValue: 0, + maxValue: 100, + step: 10, + haptics: true, + onChanged: (value) => setState(() => _currentIntValue = value), + ), + SizedBox(height: 32), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + icon: Icon(Icons.remove), + onPressed: () => setState(() { + final newValue = _currentIntValue - 10; + _currentIntValue = newValue.clamp(0, 100); + }), + ), + Text('Current int value: $_currentIntValue'), + IconButton( + icon: Icon(Icons.add), + onPressed: () => setState(() { + final newValue = _currentIntValue + 20; + _currentIntValue = newValue.clamp(0, 100); + }), + ), + ], + ), + Divider(color: Colors.grey, height: 32), + SizedBox(height: 16), + Text('Horizontal', style: Theme.of(context).textTheme.headline6), + NumberPicker( + value: _currentHorizontalIntValue, + minValue: 0, + maxValue: 100, + step: 10, + itemHeight: 100, + axis: Axis.horizontal, + onChanged: (value) => + setState(() => _currentHorizontalIntValue = value), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all(color: Colors.black26), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + icon: Icon(Icons.remove), + onPressed: () => setState(() { + final newValue = _currentHorizontalIntValue - 10; + _currentHorizontalIntValue = newValue.clamp(0, 100); + }), + ), + Text('Current horizontal int value: $_currentHorizontalIntValue'), + IconButton( + icon: Icon(Icons.add), + onPressed: () => setState(() { + final newValue = _currentHorizontalIntValue + 20; + _currentHorizontalIntValue = newValue.clamp(0, 100); + }), + ), + ], + ), + ], + ); + } +} + +class _DecimalExample extends StatefulWidget { + @override + __DecimalExampleState createState() => __DecimalExampleState(); +} + +class __DecimalExampleState extends State<_DecimalExample> { + double _currentDoubleValue = 3.0; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SizedBox(height: 16), + Text('Decimal', style: Theme.of(context).textTheme.headline6), + DecimalNumberPicker( + value: _currentDoubleValue, + minValue: 0, + maxValue: 10, + decimalPlaces: 2, + onChanged: (value) => setState(() => _currentDoubleValue = value), + ), + SizedBox(height: 32), + ], + ); + } +} diff --git a/.history/example/lib/main_20240516205202.dart b/.history/example/lib/main_20240516205202.dart new file mode 100644 index 0000000..b938ab8 --- /dev/null +++ b/.history/example/lib/main_20240516205202.dart @@ -0,0 +1,163 @@ +import 'package:flutter/material.dart'; +import 'package:numberpicker/numberpicker.dart'; + +void main() { + runApp(new ExampleApp()); +} + +class ExampleApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'NumberPicker Example', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: MyHomePage(), + ); + } +} + +class MyHomePage extends StatefulWidget { + @override + _MyHomePageState createState() => new _MyHomePageState(); +} + +class _MyHomePageState extends State { + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 2, + child: Scaffold( + appBar: AppBar( + bottom: TabBar( + tabs: [ + Tab(text: 'Integer'), + Tab(text: 'Decimal'), + ], + ), + title: Text('Numberpicker example'), + ), + body: TabBarView( + children: [ + _IntegerExample(), + _DecimalExample(), + ], + ), + ), + ); + } +} + +class _IntegerExample extends StatefulWidget { + @override + __IntegerExampleState createState() => __IntegerExampleState(); +} + +class __IntegerExampleState extends State<_IntegerExample> { + int _currentIntValue = 10; + int _currentHorizontalIntValue = 10; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SizedBox(height: 16), + Text('Default', style: Theme.of(context).textTheme.titleLarge), + NumberPicker( + value: _currentIntValue, + minValue: 0, + maxValue: 100, + step: 10, + haptics: true, + onChanged: (value) => setState(() => _currentIntValue = value), + ), + SizedBox(height: 32), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + icon: Icon(Icons.remove), + onPressed: () => setState(() { + final newValue = _currentIntValue - 10; + _currentIntValue = newValue.clamp(0, 100); + }), + ), + Text('Current int value: $_currentIntValue'), + IconButton( + icon: Icon(Icons.add), + onPressed: () => setState(() { + final newValue = _currentIntValue + 20; + _currentIntValue = newValue.clamp(0, 100); + }), + ), + ], + ), + Divider(color: Colors.grey, height: 32), + SizedBox(height: 16), + Text('Horizontal', style: Theme.of(context).textTheme.titleLarge), + NumberPicker( + value: _currentHorizontalIntValue, + minValue: 0, + maxValue: 100, + step: 10, + itemHeight: 100, + axis: Axis.horizontal, + onChanged: (value) => + setState(() => _currentHorizontalIntValue = value), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all(color: Colors.black26), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + icon: Icon(Icons.remove), + onPressed: () => setState(() { + final newValue = _currentHorizontalIntValue - 10; + _currentHorizontalIntValue = newValue.clamp(0, 100); + }), + ), + Text('Current horizontal int value: $_currentHorizontalIntValue'), + IconButton( + icon: Icon(Icons.add), + onPressed: () => setState(() { + final newValue = _currentHorizontalIntValue + 20; + _currentHorizontalIntValue = newValue.clamp(0, 100); + }), + ), + ], + ), + ], + ); + } +} + +class _DecimalExample extends StatefulWidget { + @override + __DecimalExampleState createState() => __DecimalExampleState(); +} + +class __DecimalExampleState extends State<_DecimalExample> { + double _currentDoubleValue = 3.0; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SizedBox(height: 16), + Text('Decimal', style: Theme.of(context).textTheme.titleLarge), + DecimalNumberPicker( + value: _currentDoubleValue, + minValue: 0, + maxValue: 10, + decimalPlaces: 2, + onChanged: (value) => setState(() => _currentDoubleValue = value), + ), + SizedBox(height: 32), + ], + ); + } +} diff --git a/example/lib/main.dart b/example/lib/main.dart index 7cc7a72..b938ab8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -63,7 +63,7 @@ class __IntegerExampleState extends State<_IntegerExample> { return Column( children: [ SizedBox(height: 16), - Text('Default', style: Theme.of(context).textTheme.headline6), + Text('Default', style: Theme.of(context).textTheme.titleLarge), NumberPicker( value: _currentIntValue, minValue: 0, @@ -95,7 +95,7 @@ class __IntegerExampleState extends State<_IntegerExample> { ), Divider(color: Colors.grey, height: 32), SizedBox(height: 16), - Text('Horizontal', style: Theme.of(context).textTheme.headline6), + Text('Horizontal', style: Theme.of(context).textTheme.titleLarge), NumberPicker( value: _currentHorizontalIntValue, minValue: 0, @@ -148,7 +148,7 @@ class __DecimalExampleState extends State<_DecimalExample> { return Column( children: [ SizedBox(height: 16), - Text('Decimal', style: Theme.of(context).textTheme.headline6), + Text('Decimal', style: Theme.of(context).textTheme.titleLarge), DecimalNumberPicker( value: _currentDoubleValue, minValue: 0, From 029803eb3b8e9c52b666ac7d8147a7d4c1ea5944 Mon Sep 17 00:00:00 2001 From: Georgee Date: Thu, 16 May 2024 20:56:48 +0300 Subject: [PATCH 2/2] deleted history --- .history/example/lib/main_20240516205112.dart | 163 ------------------ .history/example/lib/main_20240516205202.dart | 163 ------------------ 2 files changed, 326 deletions(-) delete mode 100644 .history/example/lib/main_20240516205112.dart delete mode 100644 .history/example/lib/main_20240516205202.dart diff --git a/.history/example/lib/main_20240516205112.dart b/.history/example/lib/main_20240516205112.dart deleted file mode 100644 index 7cc7a72..0000000 --- a/.history/example/lib/main_20240516205112.dart +++ /dev/null @@ -1,163 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:numberpicker/numberpicker.dart'; - -void main() { - runApp(new ExampleApp()); -} - -class ExampleApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'NumberPicker Example', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - home: MyHomePage(), - ); - } -} - -class MyHomePage extends StatefulWidget { - @override - _MyHomePageState createState() => new _MyHomePageState(); -} - -class _MyHomePageState extends State { - @override - Widget build(BuildContext context) { - return DefaultTabController( - length: 2, - child: Scaffold( - appBar: AppBar( - bottom: TabBar( - tabs: [ - Tab(text: 'Integer'), - Tab(text: 'Decimal'), - ], - ), - title: Text('Numberpicker example'), - ), - body: TabBarView( - children: [ - _IntegerExample(), - _DecimalExample(), - ], - ), - ), - ); - } -} - -class _IntegerExample extends StatefulWidget { - @override - __IntegerExampleState createState() => __IntegerExampleState(); -} - -class __IntegerExampleState extends State<_IntegerExample> { - int _currentIntValue = 10; - int _currentHorizontalIntValue = 10; - - @override - Widget build(BuildContext context) { - return Column( - children: [ - SizedBox(height: 16), - Text('Default', style: Theme.of(context).textTheme.headline6), - NumberPicker( - value: _currentIntValue, - minValue: 0, - maxValue: 100, - step: 10, - haptics: true, - onChanged: (value) => setState(() => _currentIntValue = value), - ), - SizedBox(height: 32), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - IconButton( - icon: Icon(Icons.remove), - onPressed: () => setState(() { - final newValue = _currentIntValue - 10; - _currentIntValue = newValue.clamp(0, 100); - }), - ), - Text('Current int value: $_currentIntValue'), - IconButton( - icon: Icon(Icons.add), - onPressed: () => setState(() { - final newValue = _currentIntValue + 20; - _currentIntValue = newValue.clamp(0, 100); - }), - ), - ], - ), - Divider(color: Colors.grey, height: 32), - SizedBox(height: 16), - Text('Horizontal', style: Theme.of(context).textTheme.headline6), - NumberPicker( - value: _currentHorizontalIntValue, - minValue: 0, - maxValue: 100, - step: 10, - itemHeight: 100, - axis: Axis.horizontal, - onChanged: (value) => - setState(() => _currentHorizontalIntValue = value), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - border: Border.all(color: Colors.black26), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - IconButton( - icon: Icon(Icons.remove), - onPressed: () => setState(() { - final newValue = _currentHorizontalIntValue - 10; - _currentHorizontalIntValue = newValue.clamp(0, 100); - }), - ), - Text('Current horizontal int value: $_currentHorizontalIntValue'), - IconButton( - icon: Icon(Icons.add), - onPressed: () => setState(() { - final newValue = _currentHorizontalIntValue + 20; - _currentHorizontalIntValue = newValue.clamp(0, 100); - }), - ), - ], - ), - ], - ); - } -} - -class _DecimalExample extends StatefulWidget { - @override - __DecimalExampleState createState() => __DecimalExampleState(); -} - -class __DecimalExampleState extends State<_DecimalExample> { - double _currentDoubleValue = 3.0; - - @override - Widget build(BuildContext context) { - return Column( - children: [ - SizedBox(height: 16), - Text('Decimal', style: Theme.of(context).textTheme.headline6), - DecimalNumberPicker( - value: _currentDoubleValue, - minValue: 0, - maxValue: 10, - decimalPlaces: 2, - onChanged: (value) => setState(() => _currentDoubleValue = value), - ), - SizedBox(height: 32), - ], - ); - } -} diff --git a/.history/example/lib/main_20240516205202.dart b/.history/example/lib/main_20240516205202.dart deleted file mode 100644 index b938ab8..0000000 --- a/.history/example/lib/main_20240516205202.dart +++ /dev/null @@ -1,163 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:numberpicker/numberpicker.dart'; - -void main() { - runApp(new ExampleApp()); -} - -class ExampleApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'NumberPicker Example', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - home: MyHomePage(), - ); - } -} - -class MyHomePage extends StatefulWidget { - @override - _MyHomePageState createState() => new _MyHomePageState(); -} - -class _MyHomePageState extends State { - @override - Widget build(BuildContext context) { - return DefaultTabController( - length: 2, - child: Scaffold( - appBar: AppBar( - bottom: TabBar( - tabs: [ - Tab(text: 'Integer'), - Tab(text: 'Decimal'), - ], - ), - title: Text('Numberpicker example'), - ), - body: TabBarView( - children: [ - _IntegerExample(), - _DecimalExample(), - ], - ), - ), - ); - } -} - -class _IntegerExample extends StatefulWidget { - @override - __IntegerExampleState createState() => __IntegerExampleState(); -} - -class __IntegerExampleState extends State<_IntegerExample> { - int _currentIntValue = 10; - int _currentHorizontalIntValue = 10; - - @override - Widget build(BuildContext context) { - return Column( - children: [ - SizedBox(height: 16), - Text('Default', style: Theme.of(context).textTheme.titleLarge), - NumberPicker( - value: _currentIntValue, - minValue: 0, - maxValue: 100, - step: 10, - haptics: true, - onChanged: (value) => setState(() => _currentIntValue = value), - ), - SizedBox(height: 32), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - IconButton( - icon: Icon(Icons.remove), - onPressed: () => setState(() { - final newValue = _currentIntValue - 10; - _currentIntValue = newValue.clamp(0, 100); - }), - ), - Text('Current int value: $_currentIntValue'), - IconButton( - icon: Icon(Icons.add), - onPressed: () => setState(() { - final newValue = _currentIntValue + 20; - _currentIntValue = newValue.clamp(0, 100); - }), - ), - ], - ), - Divider(color: Colors.grey, height: 32), - SizedBox(height: 16), - Text('Horizontal', style: Theme.of(context).textTheme.titleLarge), - NumberPicker( - value: _currentHorizontalIntValue, - minValue: 0, - maxValue: 100, - step: 10, - itemHeight: 100, - axis: Axis.horizontal, - onChanged: (value) => - setState(() => _currentHorizontalIntValue = value), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - border: Border.all(color: Colors.black26), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - IconButton( - icon: Icon(Icons.remove), - onPressed: () => setState(() { - final newValue = _currentHorizontalIntValue - 10; - _currentHorizontalIntValue = newValue.clamp(0, 100); - }), - ), - Text('Current horizontal int value: $_currentHorizontalIntValue'), - IconButton( - icon: Icon(Icons.add), - onPressed: () => setState(() { - final newValue = _currentHorizontalIntValue + 20; - _currentHorizontalIntValue = newValue.clamp(0, 100); - }), - ), - ], - ), - ], - ); - } -} - -class _DecimalExample extends StatefulWidget { - @override - __DecimalExampleState createState() => __DecimalExampleState(); -} - -class __DecimalExampleState extends State<_DecimalExample> { - double _currentDoubleValue = 3.0; - - @override - Widget build(BuildContext context) { - return Column( - children: [ - SizedBox(height: 16), - Text('Decimal', style: Theme.of(context).textTheme.titleLarge), - DecimalNumberPicker( - value: _currentDoubleValue, - minValue: 0, - maxValue: 10, - decimalPlaces: 2, - onChanged: (value) => setState(() => _currentDoubleValue = value), - ), - SizedBox(height: 32), - ], - ); - } -}