Skip to content

Commit

Permalink
Merge pull request #46 from mafreud/animated_positioned
Browse files Browse the repository at this point in the history
add animated positioned
  • Loading branch information
mafreud authored May 16, 2021
2 parents 1954275 + ea46c4e commit da74db6
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 32 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Proximity solves this problem. It enables users to touch and feel widgets so tha

## Widgets that you can touch and feel

- AnimatedPositioned
- ReorderableListView
- Slider
- Expanded
Expand Down
Binary file added assets/gif/animated_positioned.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.6.0;
MARKETING_VERSION = 1.7.0;
PRODUCT_BUNDLE_IDENTIFIER = com.flutterproximity;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -508,7 +508,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.6.0;
MARKETING_VERSION = 1.7.0;
PRODUCT_BUNDLE_IDENTIFIER = com.flutterproximity;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -538,7 +538,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.6.0;
MARKETING_VERSION = 1.7.0;
PRODUCT_BUNDLE_IDENTIFIER = com.flutterproximity;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
12 changes: 12 additions & 0 deletions lib/app/algolia/algolia_search_index.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:proximity/app/animated_positioned/animated_positioned_page.dart';
import 'package:proximity/app/reorderable_list_view/reorderable_list_view_page.dart';
import 'package:proximity/app/slider/slider_page.dart';

Expand Down Expand Up @@ -52,6 +53,10 @@ class AlgoliaSearchIndex {

static Widget retrieveWidget(String widgetName) {
switch (widgetName) {
case 'AnimatedPositioned':
{
return AnimatedPositionedPage();
}
case 'ReorderableListView':
{
return ReorderableListViewPage();
Expand Down Expand Up @@ -137,6 +142,13 @@ class AlgoliaSearchIndex {

class AlgoliaIndex {
static final index = [
{
'name': 'AnimatedPositioned',
'description':
'Animated version of Positioned which automatically transitions the child\'s position over a given duration whenever the given position changes.',
'tag': ['null safety', 'widget', 'video'],
'gif': 'assets/gif/animated_positioned.gif'
},
{
'name': 'ReorderableListView',
'description':
Expand Down
82 changes: 82 additions & 0 deletions lib/app/animated_positioned/animated_positioned_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:proximity/app/customized_widgets/custom_app_bar.dart';
import 'package:proximity/constants/proximity_colors.dart';

class AnimatedPositionedPage extends StatefulWidget {
@override
_AnimatedPositionedPageState createState() => _AnimatedPositionedPageState();
}

class _AnimatedPositionedPageState extends State<AnimatedPositionedPage> {
var selected = false;

@override
Widget build(BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
final screenWidth = MediaQuery.of(context).size.width;

return Scaffold(
appBar: CustomAppBar(
title: 'AnimatedPositioned',
documentUrl:
'https://api.flutter.dev/flutter/widgets/AnimatedPositioned-class.html',
videoUrl: 'https://youtu.be/hC3s2YdtWt8',
),
body: Center(
child: Stack(
alignment: Alignment.center,
children: [
Container(
height: screenHeight * 0.6,
width: screenWidth * 0.9,
color: ProximityColors.secondaryBlue,
child: Align(
alignment: Alignment.topCenter,
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Text(
'Stack Widget',
style: TextStyle(fontSize: 30),
),
),
),
),
Align(
alignment: Alignment.center,
child: Text(
'Rate my app 😆',
style: TextStyle(fontSize: screenWidth / 20),
),
),
AnimatedPositioned(
top: selected ? screenHeight / 3.0 : screenHeight / 2.4,
curve: Curves.fastOutSlowIn,
duration: const Duration(seconds: 1),
child: InkWell(
onTap: () {
setState(() {
selected = !selected;
});
},
child: Material(
elevation: 10,
child: Container(
color: ProximityColors.flutterBlue,
height: screenHeight / 15,
width: screenWidth / 2,
child: Align(
child: Text(
'tap me 🤩',
style: TextStyle(fontSize: 20),
),
),
),
),
),
)
],
),
),
);
}
}
46 changes: 18 additions & 28 deletions lib/app/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,10 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:proximity/app/algolia/algolia_search_index.dart';
import 'package:proximity/app/align/align_page.dart';

import '../algolia/algolia_page.dart';
import '../animated_switcher/animated_switcher.dart';
import '../algolia/algolia_search_index.dart';
import '../customized_widgets/list_tile_card.dart';
import '../expansion_panel/expansion_panel_page.dart';
import '../fractionally_sized_box/fractionally_sized_box.dart';
import '../indexed_stack/indexed_stack_page.dart';
import '../physical_model/physical_model.dart';
import '../rotated_box/rotated_box.dart';
import '../scrollbar/scrollbar_page.dart';
import '../search_delegate/search_delegate_page.dart';
import '../sliver/sliver_page.dart';
import '../switch_list_tile/switch_list_tile_page.dart';
import '../table/table_page.dart';
import '../welcome/welcome_page.dart';
import 'home_view_model.dart';

Expand Down Expand Up @@ -54,20 +42,22 @@ class HomePage extends ConsumerWidget {
: SizedBox(),
],
),
body: ListView.builder(
itemCount: dataList.length,
itemBuilder: (context, index) {
final widgetData = dataList[index];
if (widgetData.name == 'Algolia' && Platform.isAndroid) {
return SizedBox();
}
return ListTileCard(
page: AlgoliaSearchIndex.retrieveWidget(widgetData.name),
title: widgetData.name,
text: widgetData.description,
chipList: widgetData.tag,
gif: widgetData.gif,
);
}));
body: Scrollbar(
child: ListView.builder(
itemCount: dataList.length,
itemBuilder: (context, index) {
final widgetData = dataList[index];
if (widgetData.name == 'Algolia' && Platform.isAndroid) {
return SizedBox();
}
return ListTileCard(
page: AlgoliaSearchIndex.retrieveWidget(widgetData.name),
title: widgetData.name,
text: widgetData.description,
chipList: widgetData.tag,
gif: widgetData.gif,
);
}),
));
}
}
8 changes: 8 additions & 0 deletions lib/constants/proximity_colors.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:flutter/material.dart';

class ProximityColors {
static final flutterBlue = Color(0xFF02569B);
static final primaryBlue = Color(0xFF0175C2);
static final secondaryBlue = Color(0xFF13B9FD);
static final googleGray = Color(0xFF202124);
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: A new Flutter project.
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev

version: 1.6.0+9
version: 1.7.0+10

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit da74db6

Please sign in to comment.